Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Beginner questions.

Status
Not open for further replies.

PUBS

Technical User
Feb 25, 2003
1
US
I need to learn Excel VBA, where's a good place to start (website, book...)?

I need a macro to:

A) go down a column testing each cell for a non-number entry, if it is non-number then delete that row.

ex. If (col "A" row "1" = non-num, then delete row, go to next row)


B) go down a second column, summing the next 1 to 12 cells, then performing a calculation, putting the result in a cell next to the sum

Sub Macro3()
'
' Macro3 Macro
' Macro recorded 2/24/2003 by phasty
'
' Keyboard Shortcut: Ctrl+c
'
ActiveCell.Offset(2, 1).Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-5]C:R[-1]C)"
ActiveCell.Offset(0, -1).Range("A1").Select
ActiveCell.FormulaR1C1 = "=RC[1]*0.006"
ActiveCell.Offset(1, 0).Range("A1").Select
End Sub

This one works pretty well except for the ones that have a short series of numbers. Then it goes half way into the next series of numbers and does the summation.



Any help would be appreciated.
Thanks,
Phil
 
A)
For i = activesheet.usedrange.rows.count to 2 step -1
if not isnumeric(range("A" & i).value) then
rows(i).entirerow.delete
else
end if
next i

B) is the sum every 12 rows or can it be less or more ??
is there any indicator to tell you where the sum should be ?? Rgds
Geoff

Vah! Denuone Latine loquebar? Me ineptum. Interdum modo elabitur
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top