Recording macros that involve more than 1 workbook

R

Richard Champlin

Last night, my computer was upgraded to Windows XP. I found that macros I
had recorded were no longer visible. The one I used most often was rather
simple, so I just re-recorded it...it involves copying some data from a CSV
file into an Excel spreadsheet. Before the upgrade, it worked perfectly.
Now, it seems to stop functioning when I toggle between the affected files.
Any ideas?
 
M

Michael

The VBA code has change but not significantly, post your code and I maybe
able to provide a better answer.
 
R

Richard Champlin

It seems that the macro does not recognize the alt-tab toggle to another
spreadsheet.

Sub UpdateVariances()
'
' UpdateVariances Macro
' Macro recorded 8/23/2007 by Richard Champlin
'

'
Columns("A:C").Select
Selection.Delete Shift:=xlToLeft
Columns("B:H").Select
Selection.Delete Shift:=xlToLeft
Columns("F:F").Select
Selection.Delete Shift:=xlToLeft
Columns("G:H").Select
Selection.Insert Shift:=xlToRight
Columns("K:K").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Delete Shift:=xlToLeft
Rows("1:1").Select
Selection.Font.Bold = True
Columns("A:A").Select
Range(Selection, Selection.End(xlToRight)).Select
Columns("A:J").Select
Columns("A:J").EntireColumn.AutoFit
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range("A2:J21").Select
Selection.Cut
Application.CutCopyMode = False
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top