Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to execute the following code on multiple sheets in my workbook.
However, when I run the macro, it only executes on the active sheet. How do I pass the focus to each next sheet? Something is missing... Thanks! Gretta Dim sh As Worksheet Dim DestSh As Worksheet Dim shLast As Long Dim Last As Long Application.ScreenUpdating = False For Each sh In ActiveWorkbook.Worksheets Columns("B:C").Select Range("B16").Activate Selection.Unmerge Columns("B:F").Select With Selection .HorizontalAlignment = xlLeft .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With Cells.Select Range("B1").Activate Selection.EntireColumn.Hidden = False Columns("B:C").Select Selection.Insert Shift:=xlToRight Range("D3").Select Selection.Copy Range("B5").Select ActiveSheet.Paste Range("D6").Select Application.CutCopyMode = False Selection.Copy Range("C6").Select ActiveSheet.Paste Next sh Application.ScreenUpdating = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Check My Code Please - Execute Access Macro | Excel Programming | |||
How can I use VB code to execute macro when double-clicking cell? | Excel Programming | |||
macro don't execute a step in the code | Excel Programming | |||
how to execute macro from vb 6.0 code? | Excel Programming | |||
execute macro in other workbook | Excel Programming |