R
Robgould
Guest
I was wondering if anyone can help with this code. I am sure it is something simple. It works fine until the last line the (x1down) line. I am not sure what I am missing there. I got that code by recording a macro in excel. It simulates the shift/end/down keystroke which will select all fields that are in the same condition (blank or containing data) as the cell you start at. If I copy the exact same code to excel directly, it works fine.
The error I get is runtime error '424' - object required
Anyway...hope you can help. Thanks.
Code:
Dim opensheet As Object
Set opensheet = GetObject("\\Netstore\trainingdocs\Rob\Data\open.xls")
With opensheet
.Application.Visible = True
.Parent.Windows(1).Visible = True
.Application.sheets("sheet1").Select
.Application.range("g2").Select
.Application.activecell.NumberFormat = "0"
.Application.activecell = 1
.Application.activecell.Copy
.Application.range("A2").Select
.Application.range(Selection, Selection.End(xlDown)).Select
The error I get is runtime error '424' - object required
Anyway...hope you can help. Thanks.
Code:
Dim opensheet As Object
Set opensheet = GetObject("\\Netstore\trainingdocs\Rob\Data\open.xls")
With opensheet
.Application.Visible = True
.Parent.Windows(1).Visible = True
.Application.sheets("sheet1").Select
.Application.range("g2").Select
.Application.activecell.NumberFormat = "0"
.Application.activecell = 1
.Application.activecell.Copy
.Application.range("A2").Select
.Application.range(Selection, Selection.End(xlDown)).Select