I've written a little macro that open a workbook, copies the data and pastes it into this workbook.
To work the macro, I added a command button and copied the code I wrote into the sub for the command button. Now it doesn't work. It does strange things.......so firstly, does the VBA in a command button work in a different way, and how can I get around it?
My code is as follows (Sheet "Menu" has the command button, and Sheet1 is the sheet I want to copy the data into)
Sheet1.Select
Cells.Select
Cells.Delete 'at this point it deletes cells in the Menu sheet and not Sheet1!
Workbooks.Open Filename:= _
"N:\apps\database\Footapps\Shared\PanaTreas\PanaTreas.xls"
Columns("A:A").EntireColumn.AutoFit
Cells.Select
Selection.Copy
Windows("Rating-check.xls").Activate
Sheet1.Select
Application.Run "BLPLinkReset"
Range("A1").Activate
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Cells.Select
Range("C1").Activate
Application.CutCopyMode = False
Windows("PanaTreas.xls").Activate
Application.CutCopyMode = False
ActiveWorkbook.Close False
Windows("Rating-check.xls").Activate
Sheet1.Select
Cells.Select
Range("C1").Activate
Selection.Font.ColorIndex = 0
Selection.FormatConditions.Delete
Range("F6").Select
Any advice gratefully received. Tks Caroline
Bookmarks