![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Mar 2002
Posts: 12
|
I have a spreadsheet with a number of worksheets (named 'year1', 'year2', etc) which hold data for things like stock held, etc for all the weeks in a year.
I have designed an 'input' worksheet, where I would like to input the current year, the week number I'm up to, and the stock figure for that week. I would then like to click on a 'enter figures' button, where a macro would copy my data from this 'input' screen to the relevant workbook and 'week' row. My question is: If I have cell A1 on my 'Input' worksheet containing 'year2' and A2 containing '49', how do I construct a formula/macro to goto a worksheet called 'year2' and a row, say, 49? Any help would be gratefully received, bearing in mind I'm very new to all this macro stuff. Thanks |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: Brampton
Posts: 324
|
If sheets in the workbook are "Input", "Year1", "Year2", etc. then assign this macro to the button:
Worksheets("Year" & Worksheets("Input").Cells(1, 1)). _ Cells(Worksheets("Input").Cells(2, 1), 1) = _ Worksheets("Input").Cells(3, 1) |
|
|
|
|
|
#3 |
|
New Member
Join Date: Mar 2002
Posts: 12
|
Thanks for the reply, but I still can't get it to work. As I'm VERY new to macros, could you please explain the logic behind the code you gave me so I can try to understand it better.
Thanks |
|
|
|
|
|
#4 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
Sub GotoSheet() Application.Goto Sheets(Range("A1").Text).Range("A" & (Range("A2").Value)), True End Sub Ivan |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|