Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Moving to a new sheet.

I cannot for the life of me figure out how to have a macro perform a function
and then select the next sheet. I can get it to go to a specific sheet,
either by name or index, but I just want to go to the next sheet.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,355
Default Moving to a new sheet.

You may need to be more specific about what you want to do for the
"function". You may also get a quicker response in the programming group.
Post your code as well.
--
HTH,
Barb Reinhardt



"Kevin Mulvaney" wrote:

I cannot for the life of me figure out how to have a macro perform a function
and then select the next sheet. I can get it to go to a specific sheet,
either by name or index, but I just want to go to the next sheet.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Moving to a new sheet.

Thanks,

The macro is just a simple print funtion that locks all the data in the
sheet before printing.

Range("B10:B45,E7:F45,H7:N45").Select
Range("H7").Activate
ActiveSheet.Unprotect
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
<--- this is where I want to move to the next sheet --

"Barb Reinhardt" wrote:

You may need to be more specific about what you want to do for the
"function". You may also get a quicker response in the programming group.
Post your code as well.
--
HTH,
Barb Reinhardt



"Kevin Mulvaney" wrote:

I cannot for the life of me figure out how to have a macro perform a function
and then select the next sheet. I can get it to go to a specific sheet,
either by name or index, but I just want to go to the next sheet.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,355
Default Moving to a new sheet.

Try this

Sub test()
Dim aWB As Workbook
Dim aWS As Worksheet
Dim myRange As Range

Set aWS = ActiveSheet
Set aWB = ActiveWorkbook
With aWS
Set myRange = .Range("B10:B45,E7:F45,H7:N45")
.Unprotect
End With

With myRange
.Locked = True
.FormulaHidden = False
End With

aWS.Range("H7").Activate 'Not sure if this is even needed.

aWS.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"

If aWB.Worksheets.Count = aWS.Index Then
aWB.Worksheets(1).Select
Else
aWB.Worksheets(aWS.Index + 1).Select
End If

End Sub


--
HTH,
Barb Reinhardt



"Kevin Mulvaney" wrote:

Thanks,

The macro is just a simple print funtion that locks all the data in the
sheet before printing.

Range("B10:B45,E7:F45,H7:N45").Select
Range("H7").Activate
ActiveSheet.Unprotect
Selection.Locked = True
Selection.FormulaHidden = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,,,TRUE,,FALSE)"
<--- this is where I want to move to the next sheet --

"Barb Reinhardt" wrote:

You may need to be more specific about what you want to do for the
"function". You may also get a quicker response in the programming group.
Post your code as well.
--
HTH,
Barb Reinhardt



"Kevin Mulvaney" wrote:

I cannot for the life of me figure out how to have a macro perform a function
and then select the next sheet. I can get it to go to a specific sheet,
either by name or index, but I just want to go to the next sheet.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default Moving to a new sheet.



--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Kevin Mulvaney" <Kevin
wrote in message
...
I cannot for the life of me figure out how to have a macro perform a
function
and then select the next sheet. I can get it to go to a specific sheet,
either by name or index, but I just want to go to the next sheet.




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default Moving to a new sheet.

Sub movetonextsht()
Sheets(ActiveSheet.Index + 1).Select
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Kevin Mulvaney" <Kevin
wrote in message
...
I cannot for the life of me figure out how to have a macro perform a
function
and then select the next sheet. I can get it to go to a specific sheet,
either by name or index, but I just want to go to the next sheet.


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Moving to a new sheet.

Thanks for the codes. Since I am still a bit new with VB I am going to go
with Don's. It's far more simple and I can remember it.

"Kevin Mulvaney" wrote:

I cannot for the life of me figure out how to have a macro perform a function
and then select the next sheet. I can get it to go to a specific sheet,
either by name or index, but I just want to go to the next sheet.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
moving informatiion from one sheet to a total sheet john Excel Discussion (Misc queries) 2 January 31st 08 10:17 PM
Moving sheet tabs Rebecca Excel Discussion (Misc queries) 4 August 23rd 06 05:06 PM
Moving from one sheet to another Peco Worker Excel Discussion (Misc queries) 1 March 26th 06 11:48 PM
Moving from one sheet to another JMB Excel Discussion (Misc queries) 0 March 26th 06 11:44 PM
Moving sheet Greg Excel Discussion (Misc queries) 2 June 30th 05 02:21 PM


All times are GMT +1. The time now is 03:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"