G
Gandalph
Greetings from Norfolk (UK)
I am trying to generalise a specific piece of code I 'threw' together.
The first verison causes an error (as noted below) and the second runs OK.
On looking with Debug the content of "FirstCell" is the same , i.e. A1
Running Excel 2000 under Win XP
The following are the two versions of the set up and call in the main
procedure, followed by the relevant piece of code from the called procedure
SearchCol = "A"
Call DateRng(SearchCol)
*****************************
Sub DateRng(SearchCol As String)
Dim FirstCell As String * 4
FirstCell = SearchCol & GetRealFirstRow()
Range(FirstCell).Select
etc.
Generates
Run Time Error 1004
Method 'Range ' of object '_Worksheet' failed
******************************************
The following works OK
Call DateRng()
****************************
Sub DateRng()
Dim FirstCell As String * 4
FirstCell = "A" & GetRealFirstRow()
Range(FirstCell).Select
Your comments and advice would be appreciated.
I am trying to generalise a specific piece of code I 'threw' together.
The first verison causes an error (as noted below) and the second runs OK.
On looking with Debug the content of "FirstCell" is the same , i.e. A1
Running Excel 2000 under Win XP
The following are the two versions of the set up and call in the main
procedure, followed by the relevant piece of code from the called procedure
SearchCol = "A"
Call DateRng(SearchCol)
*****************************
Sub DateRng(SearchCol As String)
Dim FirstCell As String * 4
FirstCell = SearchCol & GetRealFirstRow()
Range(FirstCell).Select
etc.
Generates
Run Time Error 1004
Method 'Range ' of object '_Worksheet' failed
******************************************
The following works OK
Call DateRng()
****************************
Sub DateRng()
Dim FirstCell As String * 4
FirstCell = "A" & GetRealFirstRow()
Range(FirstCell).Select
Your comments and advice would be appreciated.