# loop through Cells

I want to loop through row 34 and if column A and B are not blank insert a value of Test in Column A Row 36 and Test2 in Row 37  Column A and then Row 36 Column B enter a 1 and then Row 37 Column B enter a  2.  Next it will move 3 columns from Column B which would be Column E and repeat the above and do this until Row 34 values are blank

Thanks,
Montrof
LVL 1
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
0
Author Commented:
Here is a sample
Sample.xlsm
0
Commented:
You can use the following code to do what you are looking for...

``````Sub updatedata()

Dim i As Long, lcol As Long
i = 1

lcol = Cells(34, Cells.Columns.Count).End(xlToLeft).Column

Do Until i > lcol

If Cells(34, i).Value <> "" Then

Cells(36, i).Value = "Test"
Cells(37, i).Value = "Test2"
Cells(36, i + 1).Value = 1
Cells(37, i + 1).Value = 2
End If

i = i + 4
Loop
End Sub
``````

Saurabh...
0

Experts Exchange Solution brought to you by