Help with Left() function in VB

  • Thread starter Thread starter erikhs
  • Start date Start date
E

erikhs

Hi,

I want to populate an array with the first 4 digits of an 8 digi
code.
But what is the VB syntax for Left(), not Left as a worksheet formula.
This is my example:

For i = 1 to usedrow
Code(i)=Range("a1").offset(i,0).Left( ?, 4) ' What can i writ
here
Next i

Any suggestions will be greatly appreciated
 
Left is a function in VBA, not a method. The format is the
same as for the worksheet function:

Code(i) = Left(Range("a1").Offset(i, 0), 4)
 
Code(1) = left$(range("a1").Offset(i,0),4)

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

|
| Hi,
|
| I want to populate an array with the first 4 digits of an 8 digit
| code.
| But what is the VB syntax for Left(), not Left as a worksheet formula.
| This is my example:
|
| For i = 1 to usedrow
| Code(i)=Range("a1").offset(i,0).Left( ?, 4) ' What can i write
| here
| Next i
|
| Any suggestions will be greatly appreciated.
|
|
| --
| erikhs
| ------------------------------------------------------------------------
| erikhs's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=32788
| View this thread: http://www.excelforum.com/showthread.php?threadid=566985
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top