PDA

View Full Version : Retrieving Data from another Worksheet



chem101
01-31-2011, 07:49 AM
Hello Everyone,

I'm using the following code to store infomation from one worksheet to another worksheet in the same workbook. The data is stored in a table-like format. The problem I'm having is retrieving the data. I would like the user to be able to retrieve the data by referencing data stored in the first column of the worksheet which is titled 'Order Number'. Any suggestions you have on the best way for me to proceed will be greatly appreciated.

Thank you!

Public Sub SaveToTable()
On Error GoTo ErrorHandler

Dim iCount As Integer

iCount = wksDataTable.Range("ptrCount").Value

With wksDataEntry
.Range(gsRNG_DATA_INPUTS).Copy
' With wksDataEntry
' .Range("c3").Copy
' .Range("e3").Copy
' .Range("c8:c22").Copy

End With

With wksDataTable
.Range("ptrTopLeft").Offset(iCount + 1, 0).PasteSpecial xlPasteValues, Transpose:=True
End With

With wksDataEntry
.Range("rngClear").ClearContents
.Range("OrderNumber").Value = .Range("OrderNumber").Value + 1
End With

ExitHere:
Exit Sub

ErrorHandler:
MsgBox Err.Number
Resume ExitHere
End Sub