Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
camerons
 
Posts: n/a
Default Concatenate function in vba

I am trying to do the following:

Sub Sample()
For a = 1 To 100
r = concatenate(Cells(a, 1), Cells(a, 2))
If r = "Mr.Jones" Then
Cells(a, 3) = ""
End If
Next a
End Sub

There is more to it, but I can't seem to use the concatenate function.
"Left", "Right" are ok, but not this one it seems. What am I missing?

Thank you
Chris Cameron



  #2   Report Post  
JMB
 
Posts: n/a
Default

you have to use the "&"

= Cells(a, 1) & Cells(a, 2)


"camerons" wrote:

I am trying to do the following:

Sub Sample()
For a = 1 To 100
r = concatenate(Cells(a, 1), Cells(a, 2))
If r = "Mr.Jones" Then
Cells(a, 3) = ""
End If
Next a
End Sub

There is more to it, but I can't seem to use the concatenate function.
"Left", "Right" are ok, but not this one it seems. What am I missing?

Thank you
Chris Cameron




  #3   Report Post  
JE McGimpsey
 
Posts: n/a
Default

One way:

Dim a As Long
For a = 1 To 100
If Cells(a, 1).Text & Cells(a, 2).Text = "Mr.Jones" Then _
Cells(a, 3).ClearContents
Next a


In article ,
"camerons" wrote:

I am trying to do the following:

Sub Sample()
For a = 1 To 100
r = concatenate(Cells(a, 1), Cells(a, 2))
If r = "Mr.Jones" Then
Cells(a, 3) = ""
End If
Next a
End Sub

There is more to it, but I can't seem to use the concatenate function.
"Left", "Right" are ok, but not this one it seems. What am I missing?

Thank you
Chris Cameron

  #4   Report Post  
camerons
 
Posts: n/a
Default

Thanks, I've got it working now.
What would you suggest for learning correct syntax for VBA?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date & Time mully New Users to Excel 4 May 23rd 05 11:56 AM
Automatically up date time in a cell Mark Excel Discussion (Misc queries) 5 May 12th 05 12:26 AM
clock Wildman Excel Worksheet Functions 2 April 26th 05 10:31 AM
Concatenate Function will not work Chuck W Excel Discussion (Misc queries) 4 January 31st 05 11:41 PM
Using CONCATENATE function to create email addresses from a list Almamba Excel Worksheet Functions 2 January 23rd 05 09:10 PM


All times are GMT +1. The time now is 09:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"