Can I put in a worksheet address for a range that is in another spreadsheet? I.e. in the example below - if the range IDList was in another spreadsheet?
Also, How do I reference that spreadsheet for where the data will be stored (CurrentlySheets(DATABASE_SHEET) in this Macro)
Sub returnevaluated()
'WillR.... http://www.ozgrid.com/forum
Dim rowindex As Long ' always dim your variables
Dim irow As String
Dim myrange As Range
TEMPLATE_SHEET = "ScoringForm"
DATABASE_SHEET = "DataStorage"
irow = Range("CASEID").Value 'i.e. the case id
Set myrange = Range("IDList") 'the lookuplist
rowindex = Application.Match(irow, myrange, 0) + 1
'gets the rowno of the case id in database...
'the rest is easy
Sheets(DATABASE_SHEET).Range("L" & rowindex).Value = Range("SCORE").Value
Sheets(DATABASE_SHEET).Range("M" & rowindex).Value = Range("COM1").Value
Sheets(DATABASE_SHEET).Range("N" & rowindex).Value = Range("COM2").Value
Sheets(DATABASE_SHEET).Range("O" & rowindex).Value = Range("COM3").Value
Sheets(DATABASE_SHEET).Range("P" & rowindex).Value = Range("COM4").Value
Application.Goto Reference:="COM1"
Selection.ClearContents
Application.Goto Reference:="COM2"
Selection.ClearContents
Application.Goto Reference:="COM3"
Selection.ClearContents
Application.Goto Reference:="COM4"
Selection.ClearContents
End Sub
Attached is the spreadsheet that works perfectly as long as ScoringForm is a sheet within DataCentral. However, I would like to have ScoringForm be a separate spreadsheet called ScoringForm.xls and maintain the same functionality.
Thanks!
Rod