skip to next part of program if a cell blank
ALL your code can be reduced to this (unless you didn't really supply it
all):
Sub Update_Performance()
For i = 1 To 70
Set mainrange = Sheets("Input").Cells(2, i).Resize(999)
If Application.CountA(mainrange) < 0 Then
mainrange.Copy
Sheets("HL" & IIf(i = 1, "", i)).Range("D2").PasteSpecial
xlPasteValues
End If
Next
End Sub
Yes -- this is all 70 steps!
Bob Umlas
Excel MVP
"SteveC" wrote in message
...
Hello, here is my code. How do I modify it so that if a range is blank,
it
will move on to the next step. For example, if the cells in A2:A1000 are
blank, how do I get the program to move on to Step 2? And if B2:B1000 are
blank, how do I get it to move on to step 3? and etc...
Sub Update_Performance()
'Step 1
Sheets("Input").Select
Range("A2:A1000").Select
Selection.Copy
Sheets("HL").Select
Range("D2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
'Step 2
Sheets("Input").Select
Range("b2:b1000").Select
Selection.Copy
Sheets("HL2").Select
Range("D2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
'Step 3
Sheets("Input").Select
Range("c2:c1000").Select
Selection.Copy
Sheets("HL3").Select
Range("D2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
'Step etc... to Step 70
end sub
|