hello to all the Excel geniuses out here!
Hopefully one of you can help me out.
I have 2 excel spreadsheets.
The first one: gets its data from a query. This spreadsheet will only ever have one row of information (that keeps changing based on the query).
The second spreadsheet: is a MASTER sheet that contains all the appended info from the first one. What I'm trying to get it to do is to link this to the first spreadsheet and when a user clicks on "Refresh", it will append the values from the first spreadsheet to the next available row .
I have the following code:
----------------------------
Private Sub Refresh_Click()
ActiveWorkbook.Sheets("Sheet1").Activate
Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
'ActiveCell.Value = [test.xls]![123]!A2
'ActiveCell.Offset(0, 1) =
End Sub
-----------------------
This works (as in it goes to the next free row).
I can't get the syntax for assigning the value right though (see : 'ActiveCell.Value = [test.xls]![123]!A2 ).
I've tried a few combinations.
I can make it work if it's in the same spreadsheet, but not if they're 2 different ones.
Does this make sense?
Can anyone help?
Thanks in advance!
Hopefully one of you can help me out.
I have 2 excel spreadsheets.
The first one: gets its data from a query. This spreadsheet will only ever have one row of information (that keeps changing based on the query).
The second spreadsheet: is a MASTER sheet that contains all the appended info from the first one. What I'm trying to get it to do is to link this to the first spreadsheet and when a user clicks on "Refresh", it will append the values from the first spreadsheet to the next available row .
I have the following code:
----------------------------
Private Sub Refresh_Click()
ActiveWorkbook.Sheets("Sheet1").Activate
Range("A1").Select
Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True
'ActiveCell.Value = [test.xls]![123]!A2
'ActiveCell.Offset(0, 1) =
End Sub
-----------------------
This works (as in it goes to the next free row).
I can't get the syntax for assigning the value right though (see : 'ActiveCell.Value = [test.xls]![123]!A2 ).
I've tried a few combinations.
I can make it work if it's in the same spreadsheet, but not if they're 2 different ones.
Does this make sense?
Can anyone help?
Thanks in advance!