K
Karthi
Hi All,
My objective is to get used range of rows and columns of another workbook
("trial_2.xls").
I will run the following macro in "trial_1.xls" workbook.
----------------------------------------------
software configuration:
Microsoft office Excel 2003 (11.8142.8132) SP2
Microsoft Visual basic 6.3
----------------------------------------------
Function two()
Dim wbk As Excel.Workbook
Dim sh As Excel.Worksheet
Dim r As Integer
Dim c As Integer
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
Set wbk =
Workbooks.Open("D:\Karthi_Works\trial\Excel_Trials\trial_2.xls", True, True)
sh = wbk.Worksheets(1)
r = sh.UsedRange.Rows.count
c = sh.UsedRange.Columns.count
MsgBox (rc)
wbk.Close
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
End Function
When I run this macro in debug mode, the value of 'wbk' shows "Nothing".
Because of this, I could not display used range of rows and columns.
The line "Set wbk =
Workbooks.Open("D:\Karthi_Works\trial\Excel_Trials\trial_2.xls", True, True)"
has
some problem. I couldnot figure it out. please, help me in this regard
Thanks
Karthi
My objective is to get used range of rows and columns of another workbook
("trial_2.xls").
I will run the following macro in "trial_1.xls" workbook.
----------------------------------------------
software configuration:
Microsoft office Excel 2003 (11.8142.8132) SP2
Microsoft Visual basic 6.3
----------------------------------------------
Function two()
Dim wbk As Excel.Workbook
Dim sh As Excel.Worksheet
Dim r As Integer
Dim c As Integer
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
Set wbk =
Workbooks.Open("D:\Karthi_Works\trial\Excel_Trials\trial_2.xls", True, True)
sh = wbk.Worksheets(1)
r = sh.UsedRange.Rows.count
c = sh.UsedRange.Columns.count
MsgBox (rc)
wbk.Close
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
End Function
When I run this macro in debug mode, the value of 'wbk' shows "Nothing".
Because of this, I could not display used range of rows and columns.
The line "Set wbk =
Workbooks.Open("D:\Karthi_Works\trial\Excel_Trials\trial_2.xls", True, True)"
has
some problem. I couldnot figure it out. please, help me in this regard
Thanks
Karthi