Hi all,
I'm very new to VB and macro programing and I am trying to do a very simple Macro for merging data. My problem is that the macro works when I am stepping through in debugger, but does not work when I am in excel and I use the shortcut key (crtl + m) to run the macro. What happens when it doesn't work properly is it selects rows 2 and 3 and tries to paste them to the new workbook and I get an error saying the cells are not the correct type. I don't want it to do this because rows 2 and 3 are titles and have nothing to do with the data I am moving. As I said before, when I open VBE and step through the code it works just fine. The error only happens when there is no data on the initial work sheet.
Thanks
Geoff
Application.CutCopyMode = False
Range("A3").Select
Do Until ActiveCell.Value = 0
ActiveCell.Offset(rowOffset:=1).Activate
Loop
ActiveCell.Offset(rowOffset:=-1).Activate
If ActiveCell.Value = ("Inspector") Then Application.Quit
Range("A3", ActiveCell).EntireRow.Copy
'
Workbooks.Open Filename:= _
"\:confused:\H&S\Construction Program\Material Hoists\Material Hoist History.xls"
Range("A3").Select
Do Until ActiveCell.Value = 0
ActiveCell.Offset(rowOffset:=1).Activate
Loop
Selection.PasteSpecial
Application.CutCopyMode = False
ActiveWorkbook.Save
Windows("Material Hoist Personal.xls").Activate
Do Until ActiveCell.Value = 0
ActiveCell.Offset(rowOffset:=1).Activate
Loop
ActiveCell.Offset(rowOffset:=-1).Activate
Range("A3", ActiveCell).EntireRow.Delete
ActiveWorkbook.Save
Application.Quit
Bookmarks