concatenate vba
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

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

Concatenate in VBA

resolvedResolved · High Priority · Version 2007

replyReply Wed 24 Mar 2010, 15:34Delegate Kate said...

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!

For upcoming training course dates see: Pricing & availability

replyReply Mon 29 Mar 2010, 08:23Trainer Stephen said...

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.

 

Please browse our web site to find out more about
excel training program and other Microsoft training courses.

Excel tip:

Convert Text into Number

Some times numbers maybe imported in as text or you maybe concatenating numbers that form a text string that now are treated, because you had to extract them by Text functions

To convert Text into Number just encase the relevant cell reference or formula in the TEXT function. See Converting American Date to European hint

eg TEXT(Ref) or TEXT(formula)

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard