Method 'Range' of object'_Worksheet' failed problem

  • Thread starter Thread starter Ivan
  • Start date Start date
I

Ivan

Hi,

An error "Method 'Range' of object'_Worksheet' failed"
is encountered when I run the following codes to select the cell in Excel.

xlsActiveSheet.Range(Cells(6, 5), Cells(6, 7)).Select

However it works fine in this

xlsActiveSheet.Range("E6:G6").Select

both codes should work fine since I have found from the help !! Does
anyone know the reason ?
 
You need to include the Sheet object for the Cells as well:

xlsActiveSheet.Range(xlsActiveSheet.Cells(6, 5), xlsActiveSheet.Cells(6,
7)).Select
 
thanks

You need to include the Sheet object for the Cells as well:

xlsActiveSheet.Range(xlsActiveSheet.Cells(6, 5), xlsActiveSheet.Cells(6,
7)).Select
 
Back
Top