Monthly Spreadsheet for Equipment Hours- I'm stuck!
Closed
Engineer225
Posts
2
Registration date
Thursday February 13, 2014
Status
Member
Last seen
March 5, 2014
-
Feb 13, 2014 at 12:47 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Mar 6, 2014 at 10:57 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Mar 6, 2014 at 10:57 AM
Related:
- Monthly Spreadsheet for Equipment Hours- I'm stuck!
- Keyboard stuck on shortcuts - Guide
- Google spreadsheet right to left - Guide
- Forex hours app for pc - Download - Finance
- Gta 4 fitgirl stuck at 0.1 ✓ - GTA Forum
- Spreadsheet function - Guide
2 responses
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Feb 17, 2014 at 11:55 AM
Feb 17, 2014 at 11:55 AM
Hi A,
Created a new workbook with one sheet and named it Sheet 1.
Each time the below code is run, a new sheet is added, renamed and formula is added to A2 to refer to the previous' sheet A1:
Now you will have to add the other formulas to the code to just simple run the code to create a new sheet.
Best regards,
Trowa
Created a new workbook with one sheet and named it Sheet 1.
Each time the below code is run, a new sheet is added, renamed and formula is added to A2 to refer to the previous' sheet A1:
Sub RunMe()
Sheets.Add(after:=Sheets(Sheets.Count)).Name = "Sheet " & Sheets.Count + 1
Range("A2").Formula = "='Sheet " & Sheets.Count - 1 & "'!A1"
End Sub
Now you will have to add the other formulas to the code to just simple run the code to create a new sheet.
Best regards,
Trowa
Engineer225
Posts
2
Registration date
Thursday February 13, 2014
Status
Member
Last seen
March 5, 2014
Mar 5, 2014 at 08:43 AM
Mar 5, 2014 at 08:43 AM
Thanks for the reply TrowaD.
I'm not familiar with the proper terminology that is used for excel.
Running this code...
Where is this code entered?
When you say add the formula to the code, Is it all entered into the cell?
I apologize for my short dictionary on terminology used.
Best Regards,
A
I'm not familiar with the proper terminology that is used for excel.
Running this code...
Where is this code entered?
When you say add the formula to the code, Is it all entered into the cell?
I apologize for my short dictionary on terminology used.
Best Regards,
A
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Mar 6, 2014 at 10:57 AM
Mar 6, 2014 at 10:57 AM
No worries A,
Let's look at your questions:
Where is this code entered?
After opening Excel, hit Alt+F11 to open the Visual Basic window.
Go to top menu > Insert > Module.
Copy-Paste the code in the big white field.
You can now close the Visual Basic window.
Back at Excel, hit Alt+F8 to open a small window showing the available Macro's.
Double-click on RunMe to "run the code".
When you say add the formula to the code, Is it all entered into the cell?
You said in your original post that you had 40+ cells that needs to pulled.
Since I don't know the source nor the destination, I couldn't add them to the code.
That is what I meant by adding the formulas to the code.
The formula in the code now looks like:
Range("A2").Formula = "='Sheet " & Sheets.Count - 1 & "'!A1"
Here Range("A2").Formula refers to the destination cell on the newly created sheet.
The actual formula in code form is "='Sheet " & Sheets.Count - 1 & "'!A1"
In excel it will look like ='Sheet #'!A1. Where # refers to the sheets number (second to last, since the newly created sheet will be the last sheet).
So if you would like to pull data from A10 from the previous sheet and place it in A5. The code line would look like:
Range("A5").Formula = "='Sheet " & Sheets.Count - 1 & "'!A10"
To put the formula =A1-A2 in cell A3, use the code line:
Range("A3").Formula = "=A1-A2"
Place these code lines just above the End Sub line.
Hopefully I have clarified some issues.
Let me know if further assistance is desired.
Best regards,
Trowa
Let's look at your questions:
Where is this code entered?
After opening Excel, hit Alt+F11 to open the Visual Basic window.
Go to top menu > Insert > Module.
Copy-Paste the code in the big white field.
You can now close the Visual Basic window.
Back at Excel, hit Alt+F8 to open a small window showing the available Macro's.
Double-click on RunMe to "run the code".
When you say add the formula to the code, Is it all entered into the cell?
You said in your original post that you had 40+ cells that needs to pulled.
Since I don't know the source nor the destination, I couldn't add them to the code.
That is what I meant by adding the formulas to the code.
The formula in the code now looks like:
Range("A2").Formula = "='Sheet " & Sheets.Count - 1 & "'!A1"
Here Range("A2").Formula refers to the destination cell on the newly created sheet.
The actual formula in code form is "='Sheet " & Sheets.Count - 1 & "'!A1"
In excel it will look like ='Sheet #'!A1. Where # refers to the sheets number (second to last, since the newly created sheet will be the last sheet).
So if you would like to pull data from A10 from the previous sheet and place it in A5. The code line would look like:
Range("A5").Formula = "='Sheet " & Sheets.Count - 1 & "'!A10"
To put the formula =A1-A2 in cell A3, use the code line:
Range("A3").Formula = "=A1-A2"
Place these code lines just above the End Sub line.
Hopefully I have clarified some issues.
Let me know if further assistance is desired.
Best regards,
Trowa