M
mathel
I am new to VBA, but have been able to do some automation in a workbook
partially by recording a macro, by research, and a few questions to this
website. Almost finished, but I need a little more help.
On a worksheet in my workbook, I have a variable range, which, once found, I
have a total put into Column L. The range is then copied and pasted into
another workbook. However, if the total in Column L is 0.00, I need to skip
the rest of the routine and move to the next sub routine called CopyCosts.
Following is part of the sub routine I am working with:
Range("H1:h45").Select
Selection.Find(What:=" ", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate
ActiveCell.Offset(0, 4).Select
ActiveCell.Offset(-1, 0).Select
ActiveCell.Value = Application.Sum([d2:d46])
Dim lastRow As Long
lastRow = Cells(Rows.Count, "l").End(xlUp).Row
'set variable to the last used row in L
Range("H1:L" & lastRow).Copy
Sheets("Input").Select
Workbooks.Open Filename:="G:\" & Range("A1").Value & "\BD"
What statement would be used so that if Application.Sum([d2:d46]) = 0.00,
end, then go to next sub?
Thanks
partially by recording a macro, by research, and a few questions to this
website. Almost finished, but I need a little more help.
On a worksheet in my workbook, I have a variable range, which, once found, I
have a total put into Column L. The range is then copied and pasted into
another workbook. However, if the total in Column L is 0.00, I need to skip
the rest of the routine and move to the next sub routine called CopyCosts.
Following is part of the sub routine I am working with:
Range("H1:h45").Select
Selection.Find(What:=" ", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate
ActiveCell.Offset(0, 4).Select
ActiveCell.Offset(-1, 0).Select
ActiveCell.Value = Application.Sum([d2:d46])
Dim lastRow As Long
lastRow = Cells(Rows.Count, "l").End(xlUp).Row
'set variable to the last used row in L
Range("H1:L" & lastRow).Copy
Sheets("Input").Select
Workbooks.Open Filename:="G:\" & Range("A1").Value & "\BD"
What statement would be used so that if Application.Sum([d2:d46]) = 0.00,
end, then go to next sub?
Thanks