Hi All, <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
ffice
ffice" /><o
></o
>
<o
></o
>
Here is the situation, in sheet1 of a workbook, column A contains text values, for example "EXFRMR123456" or "EXFRMR143678". I am looking to extract the numeric sequence at the end of each cell into column B of the same worksheet. I wrote the following: <o
></o
>
<o
></o
>
<o
></o
>
<o
></o
>
The code returns an "invalid use of null" error and, according to the debugger, the line I commented next to is the culprit.<o
></o
>
<o
></o
>
I think the problem lies in the "Sheet1.Range("A:A").Text". When I change the range to one cell only the code works fine, only with the full column does it return the error.
<o
></o
>
<o
>Also, it is worth noting that I have to do this in VBA, I cannot use the =mid function in sheet.</o
>
<o
></o
>
<o
></o
>
Any help would be appreciated<o
></o
>
<o
></o
>
<o
></o
>
-Joe <o
></o
>




<o


Here is the situation, in sheet1 of a workbook, column A contains text values, for example "EXFRMR123456" or "EXFRMR143678". I am looking to extract the numeric sequence at the end of each cell into column B of the same worksheet. I wrote the following: <o


<o


Code:
[COLOR=black][FONT=Verdana]Sub find_char()<o:p></o:p>[/FONT][/COLOR]
[FONT=Verdana][COLOR=black]Dim model_code As String[/COLOR][/FONT]
[FONT=Verdana][COLOR=black]Dim model_code_ex As String<o:p></o:p>[/COLOR][/FONT]
[COLOR=black][FONT=Verdana]<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]model_code = Sheet1.Range("A:A").Text 'This line errors out[/FONT][/COLOR]
[FONT=Verdana][COLOR=black]model_code_ex = Mid(model_code, 7, 6)<o:p></o:p>[/COLOR][/FONT]
[COLOR=black][FONT=Verdana]<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]Sheet1.Range("B:B") = model_code_ex<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]End Sub<o:p></o:p>[/FONT][/COLOR]


<o


The code returns an "invalid use of null" error and, according to the debugger, the line I commented next to is the culprit.<o


<o


I think the problem lies in the "Sheet1.Range("A:A").Text". When I change the range to one cell only the code works fine, only with the full column does it return the error.
<o


<o


<o


<o


Any help would be appreciated<o


<o


<o


-Joe <o


Last edited: