MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Referencing a unique identifer from another worksheet.


Posted by Nate Hamilton on October 11, 2001 10:54 AM

What I need to do is reference another worksheet using using an id. That id will match up with the same id on the other workbook. If that id matches up, then I need to take the column to the right on the referenced worksheet and copy that value and paste it on the orginal sheet in the column to the right of that id. Any suggestions. I don't even know where to start. Any help would be greatly appreciated.


Posted by Jerid on October 12, 2001 4:10 AM


This should get you started. Good Luck

Sub CheckId()
Dim CurSheet As Worksheet
Dim vIdNum As Variant

'Collect the ID from original sheet, in this case sheet1
vIdNum = Worksheets("Sheet1").Range("A1").Value

'Look at the other sheets until we find a matching IdNum
For Each CurSheet In Application.Worksheets
CurSheet.Activate
If CurSheet.Name <> "Sheet1" Then
If CurSheet.Range("A1").Value = vIdNum Then
Columns("B:B").Select
Selection.Copy
Sheets("Sheet1").Select
Columns("B:B").Select
ActiveSheet.Paste
End If
End If
Next CurSheet

End Sub


Jerid

Posted by Jerid on October 12, 2001 4:13 AM

Hi Nate, give this a try.

Sub ColumnLooper()

Dim iX As Integer

For iX = 1 To 5000
Range("N" & iX).Select
If UCase(ActiveCell.Value) = "Y" Then
MsgBox "The List Cost has changed more than" & vbCrLf & "the allowed changed percentage."
End If
Next iX
End Sub

Jerid

Posted by Jerid on October 12, 2001 4:15 AM

Posted Incorrectly (NT)

.