|
-
Jul 2nd, 2012, 04:39 PM
#1
Thread Starter
New Member
lining up information across columns
I am using Excel. I am trying to compare information within two columns to each other and line the second columns rows up with the first to where the information matches. In the long run, I want to be able to move multiple columns of the same row to line up with one column. (I'm matching PLC addresses to all the different descriptions of each address by finding which row has the corresponding PLC address with it). But as of right now, I keep getting error 91, something about With block variable not set. The help file nor google helped me with this error, so could someone take a look at my code and explain it to me please? Thank you.
Sub LineUp()
Dim i As Integer
Dim h As Integer
Dim worksheet As Worksheet
i = 1
h = 1
With worksheet
For h = 1 To 10 Step 1
If worksheet.Range("Ai").Value = worksheet.Range("Dh, D10").Value Then
worksheet.Range("F1") = worksheet.Range("D1").Value
End If
Next h
End With
End Sub
P.S. i isn't being used yet
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|