PDA

View Full Version : Loop Case Statement



Emoncada
12-02-2014, 06:06 PM
I have a spreadsheet that I would like to look at Column A and grab first and last row as a range.
Then I need for it to loop through that range and based on each cell in range put a value in Column H in same row.
So it select case first cell in range and return it's case value to H, then go to next cell in range and continue until it's done with range.
Any help would be great.

Bob Phillips
12-03-2014, 01:09 AM
Something along the lines of



For i = 2 To Range("A2").End(xlDown).Row

If Cells(i, "A").Value = somevalue Then

Cells(i, "H").Value Cells(i, "A").Value
End If
Next i

snb
12-03-2014, 01:36 AM
Sub M_snb()
UsedRange.Columns(1).Offset(, 7) = UsedRange.Columns(1).Value
End Sub

SamT
12-03-2014, 12:45 PM
For each Cel in UsedRange.Columns(1)
Select Case Cel
Case 1: Range("H" & CStr(Cel.Row)).Value = "Answer1"
End Select
Next Cel