• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 102
  • Last Modified:

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
0
montrof
Asked:
montrof
  • 2
  • 2
1 Solution
 
Saurabh Singh TeotiaCommented:
Can you update your sample file clearly showing what is before and after about what you want to do..as reading your comments i'm still not sure about what you are looking for...
0
 
montrofAuthor Commented:
Here is a sample
Sample.xlsm
0
 
Saurabh Singh TeotiaCommented:
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

Open in new window


Saurabh...
0
 
montrofAuthor Commented:
As Always thank you so much for your help

--Montrof
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now