Hi All,
[first post!]
I'm new at this, so please feel free to point out better methods. However, I'd still also like to know the answer to the original question.
I have 2 sheets I'm concerned with. I have no idea what the user will have named them, nor what sheet they started on when they started the macro. So I have them navigate to a Destination sheet, then a source Data sheet, one at a time. They select any cell (or range) on both of these worksheets. This forces them to view the data and make sure they know where their information is being migrated from and to. It's also just the first way I figured out how to get them to pick a range!
Basically, I need to know the names of the Destination and source Data worksheets so that I can refer to and select them! See *** below. Thanks so much.
Sub UpdateQTY()
Dim DataRange, DestRange As Range
Set DestRange = GetDest()
Set DataRange = GetData()
'***[RIGHT HERE I WANT TO SELECT THE WORKSHEET THAT DestRange IS FROM, SO THAT I CAN THEN GATHER THE COLUMN NUMBER INFO I NEED.]
PartNumbCol = ColNum("PART NUMBER")
QtyCol = ColNum("QTY")
DateCol = ColNum("Date")
'...
End Sub
Function GetDest() As Range
Dim DestRange As Range
Set DestRange = Application.InputBox("1. Navigate to the destination sheet that you want to update." & Chr(13) _
& "2. Select any cell to confirm the sheet." & Chr(13) & "3. Click 'OK'.", Type:=8)
Set GetDest = DestRange
End Function
Function GetData() As Range
Dim DataRange As Range
Set DataRange = Application.InputBox("1. Navigate to the sheet containing new source data." & Chr(13) _
& "2. Select any cell to confirm the sheet." & Chr(13) & "3. Click 'OK'.", Type:=8)
Set GetData = DataRange
End Function
Bookmarks