macro running on current sheet

kelvin_9

Active Member
Joined
Mar 6, 2015
Messages
460
Office Version
  1. 2019
hi all, someone know any problem might happened in my below code?
i record my code to add a new sheet and then refer to my main code on current sheet, but it's doesn't work property
thanks for the advice :)

Sub Macro001()
'
' Macro001 Macro
'


'
Sheets("MASTER").Visible = True
Sheets("Master").Select
Sheets("Master").Copy After:=Sheets(3)
Sheets("MASTER (2)").Select
Sheets("MASTER (2)").Name = "00001"
Sheets("MASTER").Visible = False
Sheets("00001").Select


End Sub
Sub Macro001()
'
' Macro001 Macro
'


'
Range("B4").Select
ActiveCell.FormulaR1C1 = "=CONCATENATE(""4000"",Pre-Count!R[-1]C)"



End Sub
****** id="cke_pastebin" style="position: absolute; top: 408px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">End Sub</body>
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Which sheet is the second set of code meant to run on?
 
Upvote 0
Firstly you have 2 subs with the same name. Change the name of one of them.
Secondly what doesn't "Work Properly"?
 
Upvote 0
i have 2 module.
module 1 is used to be add sheet(assume 10sheets in total)
module 2 is record my code

i set combobox and run module1 and then module2
module1 works fine and module2 will pop up a small window on top left corner with name"update values:count"


thanks Norie & Fluff
 
Upvote 0
I don't understand this
module2 will pop up a small window on top left corner with name"update values:count"
Could you please re-explain
 
Upvote 0
after i run moudle1 to add a new sheet(named 00001)
it works
but then it cant load module2 successfully which is:
Range("B4").Select
ActiveCell.FormulaR1C1 = "=CONCATENATE(""4000"",Pre-Count!R[-1]C)"

it pop up a small window like to open a file from top left menu

sorry for my poor presentation
:eeek:
 
Upvote 0
Do you have a sheet in that workbook called Pre-Count?
 
Upvote 0
yes, Fluff
i have 2 sheet at all, which is Pre-Count and 00001 after added.
but i doubt, why i added a new sheet and named 00001, i can't run the other macro in current sheet B4
 
Upvote 0
Select the pre-count sheet & run this
Code:
Sub Chk()
MsgBox "|" & ActiveSheet.Name & "|"
End Sub
What does the msgbox say?
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

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