can anyone help me? i have this syntax
Dim oExcel As Variant
Dim oWB As Variant
'Set oWB = CreateObject("Object.Workbook")
Set oExcel = CreateObject("Excel.Application")
Set oWB = oExcel.Workbooks.Open("Z:\MPR\Maret 2017\31 - 03 -2017\DF\PAL - DF.xlsx")
oWB.Sheets(1).select
Dim oNumRow As Integer
'oNumRow = oWB.Sheets(1).UsedRange.Count
With oWB
oNumRow = oWB.Sheets(1).Cells(oWB.Sheets(1).Rows.Count, "A").End(xlUp).row 'error
End With
oNumRow = oWB.Sheets(1).Cells(oWB.Sheets(1).Rows.Count, 1).End.row 'error
oNumRow = oWB.Sheets(1).Range("A1", oWB.Sheets(1).Range("A1").End(xlDown).row).Rows.Count'error
if i change the Dim oExcel As Variant
to Dim oExcel As Excel.Application, the program error in there. Can anyone suggest any idea? I'm new in programing vba for macro