unable to apply a procedure from a different module into one module

Makwa

New Member
Joined
Mar 6, 2023
Messages
3
Office Version
  1. 365
  2. 2021
  3. 2013
Platform
  1. Windows
I have created 2 procedures and named them macro2 and Macro1
Macro2 is formatting and cleaning data
Macro1 is to assign the values of column H to Colum G using an = formula
Macro2 is supposed to execute first then Macro1
Now the problem is when i run macro2 everything is fine except that it doesn't stop when all my sheets are exhausted instead it jump into a new worksheet and gives me an error
Then when is time to run Macro1 It automatically gives me an error and cannot start it
i have attached screenshots please assist.

Capture1.PNG
Capture2-this one id for inserting the formula and sort is named Macro1.PNG
Also rememeber that Macro1 was copied from Module2 to Module1
 

Attachments

  • Capture3.PNG
    Capture3.PNG
    74.7 KB · Views: 6

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
You have 2 different kinds of modules there. Sheet modules are related to a particular sheet so you can often get away without being specific, such as when writing
Range("A4").Select

Standard modules (e.g. Module1) have no such connection to a sheet. You cannot simply write Range("A4").Select because it has no idea what sheet you're referring to. Same applies to userform code - it would not know what sheet you meant either.

Posting pics of code sometimes works for obvious issues, but if it required testing, I'm fairly certain no one would want to type out your code manually. Consider posting code in code tags (vba button on posting toolbar).
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,332
Members
449,077
Latest member
jmsotelo

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