Twisted_Squeegie
New Member
- Joined
- Jan 4, 2018
- Messages
- 6
Im getting a "Compile error: Expected: Then or GoTo" in an If ... Then statement.
My worksheet comes from a data logger that can record 20+ channels of data. The number of channels and channel numbers can change depending on the setup. If the channel is not being recorded the column header is labeled as "OFF" (with the quotes). Im trying to write a little snippet that will delete any columns that are not used.
col = 22
Do Until col = 2
if Cells(5, col).Value = " "OFF"" Then ' The value of the cell has a space then "OFF"
Columns(col).Delete
'do some stuff
Else
'do some other stuff
End If
col = col - 1
Loop
My worksheet comes from a data logger that can record 20+ channels of data. The number of channels and channel numbers can change depending on the setup. If the channel is not being recorded the column header is labeled as "OFF" (with the quotes). Im trying to write a little snippet that will delete any columns that are not used.
col = 22
Do Until col = 2
if Cells(5, col).Value = " "OFF"" Then ' The value of the cell has a space then "OFF"
Columns(col).Delete
'do some stuff
Else
'do some other stuff
End If
col = col - 1
Loop