concatenate vba

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Concatenate in VBA

Concatenate in VBA

resolvedResolved · High Priority · Version 2007

Kate has attended:
Access Introduction course
Access Intermediate course

Concatenate in VBA

I need to use VBA in order to input a formula in each cell of a column (or just the result of a formula) which uses Left/Right and Mid in order to select the components to be concatenated.

In Excel this would look like:

=CONCATENATE(LEFT(B2,2),":",MID(B2,3,2),":",RIGHT(B2,2))

in VBA I need to replace B2 with Cells(intRowCount, 6) where intRowCount increases up to the total row count.

I also want to apply two separate formulae, one if the value of B2 is greater than 2359.59 and one if it is lower.

Unfortunately I keep getting syntax errors.

Please help!

RE: Concatenate in VBA

Hi Kate

Thanks for your question

There is no VB concatenate function. Instead I suggest the following

LEFT(B2,2),&":",&MID(B2,3,2)&,":",&RIGHT(B2,2)


This should create the string you are looking for

Regards

Stephen

Sun 4 Apr 2010: Automatically marked as resolved.

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Create your own custom list on Excel 2010!

If you know how to use the auto-fill option on Excel then why not create your own customs lists?

The auto fill feature saves you time by allowing you to enter one of the list entries into a cell and then use your mouse to automatically drag the rest of the list into the cells below, above or to either side of the initial cell. When using your mouse to perform this task you will see a thin black cross appear at the bottom right hand side of the cell. Click, hold and drag to make the list appear.

Default lists include weekdays and months. To create your own list in Excel 2010 do the following;

>File
>Options
>Advanced
>Scroll right to the bottom of the page and you will see a buttom "edit custom lists", click this button
>enter your list in the list entries
>click add

Now try it out. Good luck.
>

View all Excel hints and tips


Server loaded in 0.08 secs.