how to embed a sheet and call it for a command

UMAKEMESIK

Active Member
Joined
Oct 3, 2005
Messages
378
I have a command I would like to run on a work sheet.

With a macro button I would like to call on sheet 2 for the command but my syntax is incorrect.

Any help would be appreciated.

here is my code.

Code:
Application.ScreenUpdating = False
    
    Worksheet.Open Sheets(Sheet2)
       
    Range("A1").Select
    Selection.Copy
    ActiveWorkbook.Close
    Range("AB3").Select
      ActiveSheet.Unprotect "dod"
    ActiveSheet.PasteSpecial Format:="Unicode Text", Link:=False, _
        DisplayAsIcon:=False
    ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
        True
    Application.ScreenUpdating = True

mY worksheet open line is getting the error.

thanks
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
UMAKEMESIK,


If the worksheet name is Sheet2, try:


Code:
Worksheets("Sheet2").Activate




If the worksheet is the second worksheet (moving left to right) try:


Code:
Worksheets(2).Activate
 
Last edited:
Upvote 0
Thanks for taking the time.

I think it's doing exactly what it is supposed to. When I click on the macro button that calls out that command it closes the first sheet and then closes everything.

Here is what I was thinking of doing. Everything below the worksheet acitivate line works in another scenario. I have a separate worksheet called numberlog and when i click on the button on worksheet 1 it calls to the number log worksheet. The numberlog worksheet generates a number and then that number gets pasted back onto worksheet 1.

This is how i generate a sequential numbering system to create non-repeating workorder numbers.

I am trying to embed the Numberlog worksheet into worksheet 1 so the user does not have to be connected to the network and can generate their own series of workorder numbers when they are working offline.

Any help would be appreciated.
 
Upvote 0
UMAKEMESIK,

I am not following what you are trying to do.

Please click on the Post Reply button, then enter just the word BUMP, and then click on the Submit Reply button, and someone else will assist you.
 
Upvote 0

Forum statistics

Threads
1,224,525
Messages
6,179,319
Members
452,905
Latest member
deadwings

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