View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
JCanyoneer JCanyoneer is offline
external usenet poster
 
Posts: 56
Default Looping letters (or columns)

I have a section of code that runs muliply times that could be reduced to a
loop if I could figure out the syntax. Looking for help with this:

' Alternating Safety Lights
If ThisWorkbook.Worksheets("Sheet1").Range("A19") = True Then
destWB.Worksheets("Sheet1").Range("H" & Lr) = "X"
End If
' Bed Step
If ThisWorkbook.Worksheets("Sheet1").Range("A20") = True Then
destWB.Worksheets("Sheet1").Range("I" & Lr) = "X"
End If
' Blanket Can Holder
If ThisWorkbook.Worksheets("Sheet1").Range("A21") = True Then
destWB.Worksheets("Sheet1").Range("J" & Lr) = "X"
End If
' Canopy Roof
If ThisWorkbook.Worksheets("Sheet1").Range("A22") = True Then
destWB.Worksheets("Sheet1").Range("K" & Lr) = "X"
End If

Each if loop is basically for a different part (There are 38 parts). The
loop needed must change the Range("Axx") value (I can do this pretty easy,
for xx=19 to 22), the part I nee help with is the Letter or Column loop
changing the Range("X" & Lr) from H to K. Anyone have any simple ideas?