Simple Macro from Sheet2 to Sheet1 - New to VBA

JBank19

New Member
Joined
Apr 27, 2018
Messages
4
I am new to VBA and eager to continue learning. I created a simple form by selecting the range in a table, then recorded this to a Macro (BoardWriteupTest1). This is located on Sheet2 of the Workbook and ideally I would like this page to be simply a data collection page so I can pull the information and have it filter to Sheet1 which is basically an in-house template. How do I get the Macro to run when I am on Sheet1? I'm sure there is a simple solution to this. Thank you for any feedback provided.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
This answer is under the assumption you want to run the macro from Sheet1 but have it perform how it normally would on Sheet2. If you want the same process that would normally work on Sheet2 cells to work on Sheet1 cells, you'll have to go in and edit the code or redo the macro.

------------------------------------------------------------------------------------------------------------------------

You can run a macro from anywhere a few ways.

1st Option: Setting Hotkeys
1) Go to the View tab at the top
2) On the far right click the Macros dropdown
3) View Macros
4) Click on the macro you recorded and then click Options
5) Type a letter in the box and hit Ok. Now when you hit "ctrl + (letter)", you'll execute the macro.

2nd Option: From the Code
If you are getting into VBA and don't have the developer tab (it will be next to the view tab, very easy to see), you should access that for sure.
Info on that can be found here: https://www.techonthenet.com/excel/questions/developer_tab2013.php

I believe without accessing the developer tab you can still access macro codes by hitting alt + F11. In here you can go to the Modules and click into the module. You'll see some code (probably the macro you made if you only made one) and you can click into it and click the green "forward" looking button under the tabs on this window. That's what I usually do because I don't often create macros, but create modules with code and run them on the fly. If you delve into VBA more, this is likely what you will do too.

3rd Option: Creating a button
You can create a button after you access the developer tab that I mentioned before. I would do some googling on this but it's not very complicated and with Form Control buttons, they are set up to the macro you want with just a simple click. Very easy, and you can put that button wherever you want. Clicking will execute the code.

Hope this helps!

Kyle
 
Last edited:
Upvote 0
Thanks for the information. I may not be exactly clear on what I'm trying to do. The Form that is turned into a Macro is located on Sheet 2. For all intensive purposes the sheet will be hidden. So when the workbook opens (preferably on Sheet 1) the form will open and after completing the template that was developed on Sheet 1 would have VLookup functions pulling the data from the hidden Sheet 2. But when I try and get the Macro to run on Sheet 1 I get an error message. Hopefully this helps clarify my dilemma. Thank you for any and all suggestions made.
 
Upvote 0
Hi & welcome to the board.
Can you post the code you're using?
When doing so please use code tags, the # icon in the reply window
 
Upvote 0

Forum statistics

Threads
1,215,366
Messages
6,124,516
Members
449,168
Latest member
CheerfulWalker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top