S
sa02000
I keep getting
Run time error '1004'
Select method of Range class failed from this. I don't see anything
wrong with it. Any help??
Sub Import()
Dim strname As String
strname = ActiveWorkbook.Name
Workbooks.Open "C:\Macro_Practice\Sep_download.xls"
' wkbBook = Workbooks("Sep_download.xls")
Workbooks("Sep_download.xls").Worksheets(1).Copy
before:=Workbooks(strname).Worksheets(3)
Workbooks("Sep_download.xls").Close savechanges:=True
Sheets("sheet2").Select
ActiveWindow.SelectedSheets.Delete
Sheets("sep_download").Select
Range("I2").Select
ActiveCell.FormulaR1C1 = "=Trim(RC[-8])"
Range("I2").Select
Call GetRealLastCell
Selection.AutoFill Destination:=Range(I2, RealLastRow)
End Sub
Sub GetRealLastCell()
Dim RealLastRow As Long
Dim RealLastColumn As Long
Range("A1").Select
On Error Resume Next
RealLastRow = _
Cells.Find("*", [A1], , , xlByRows, xlPrevious).Row
RealLastColumn = _
Cells.Find("*", [A1], , , xlByColumns, xlPrevious).Column
Cells(RealLastRow, RealLastColumn).Select
End Sub
Run time error '1004'
Select method of Range class failed from this. I don't see anything
wrong with it. Any help??
Sub Import()
Dim strname As String
strname = ActiveWorkbook.Name
Workbooks.Open "C:\Macro_Practice\Sep_download.xls"
' wkbBook = Workbooks("Sep_download.xls")
Workbooks("Sep_download.xls").Worksheets(1).Copy
before:=Workbooks(strname).Worksheets(3)
Workbooks("Sep_download.xls").Close savechanges:=True
Sheets("sheet2").Select
ActiveWindow.SelectedSheets.Delete
Sheets("sep_download").Select
Range("I2").Select
ActiveCell.FormulaR1C1 = "=Trim(RC[-8])"
Range("I2").Select
Call GetRealLastCell
Selection.AutoFill Destination:=Range(I2, RealLastRow)
End Sub
Sub GetRealLastCell()
Dim RealLastRow As Long
Dim RealLastColumn As Long
Range("A1").Select
On Error Resume Next
RealLastRow = _
Cells.Find("*", [A1], , , xlByRows, xlPrevious).Row
RealLastColumn = _
Cells.Find("*", [A1], , , xlByColumns, xlPrevious).Column
Cells(RealLastRow, RealLastColumn).Select
End Sub