View Single Post
 
Old 06-07-2017, 05:47 AM
NoSparks NoSparks is offline Windows 7 64bit Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

Assuming it's you, and not something that determines what columns to work on programmatically,
put your code inside a loop to use a variable for the column to work on.
Replace the "B"'s you have in your code with that variable, for example...
Code:
For j = 1 To 4
    'which column to loop
    col = Choose(j, "B", "K", "N", "X")

    With Sheet2
        LastRow = .Range(col & .Rows.Count).End(xlUp).Row
        
        For i = 2 To LastRow
            .Range(col & i).Value = .Range(col & i).Value / 3.3
        Next i

        'just format what's needed not entire columns
        .Range(col & "2:" & col & LastRow).NumberFormat = "###0.0"
    End With
Next j
Reply With Quote