Selecting variable sheet

zwans

Board Regular
Joined
May 11, 2010
Messages
58
Hi,

In cel E7 there is the name of one of my sheets.
Now i want to select this sheet by a macro.

I tried:

Range("E7").Select
Sheets(ActiveCell.Value).Select

but this won't work.
Does anyone know how i can solve this problem?

With kind regards,

Ronald Buikema
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Try..
Code:
Sub iopen()
Worksheets(Range("E7").Text).Activate
End Sub

works for me.
 
Upvote 0
I tested my macro and it works well.
The name in E7 must be eguals to the name of sheet. Check this!
 
Upvote 0
Ok, i checked that and it's ok.

Ik get the following error:

Error 9

The subscript is out of range

My code is the following:

Sub Macro1()
'
' Macro1 Macro
' De macro is opgenomen op 25-7-2011 door Ronald Buikema.
'
UserForm1.Show
Sheets("Informatie").Select
Range("F6").Select
Selection.Copy
nm = Range("E6")
Sheets(nm).Activate
Range("P1").Select
Selection.Paste
Application.CutCopyMode = False
'
End Sub

Can someone help me with this?

With kinds regards,

Ronald Buikema
 
Upvote 0
Ok, i checked that and it's ok.

Ik get the following error:

Error 9

The subscript is out of range

My code is the following:

Sub Macro1()
'
' Macro1 Macro
' De macro is opgenomen op 25-7-2011 door Ronald Buikema.
'
UserForm1.Show
Sheets("Informatie").Select
Range("F6").Select
Selection.Copy
nm = Range("E6")
Sheets(nm).Activate
Range("P1").Select
Selection.Paste
Application.CutCopyMode = False
'
End Sub

Can someone help me with this?

With kinds regards,

Ronald Buikema


Try this...
Code:
' Macro1 Macro
' De macro is opgenomen op 25-7-2011 door Ronald Buikema.
'
UserForm1.Show
Sheets("Informatie").Select
Range("F6").Select
Selection.Copy
nm = Range("E6")
Sheets(nm).Activate
Range("P1").Select
Activesheet.Paste
Application.CutCopyMode = False
'
End Sub
 
Upvote 0
This also works...
Code:
Sub iopen()
UserForm1.Show
Sheets("Informatie").Select
Range("F6").Select
Selection.Copy
Worksheets(Range("E6").Text).Activate
Range("P1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
 
Upvote 0
Try:
Code:
Sub Macro1()
'
' Macro1 Macro
' De macro is opgenomen op 25-7-2011 door Ronald Buikema.
'
UserForm1.Show
nm = Sheets("Informatie").Range("E6")
Sheets("Informatie").Range("F6").Copy Destination:=Sheets(nm).Range("P1")

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,734
Members
452,939
Latest member
WCrawford

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