Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
Thanks, I've got it working now.
What would you suggest for learning correct syntax for VBA? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Date & Time | New Users to Excel | |||
Automatically up date time in a cell | Excel Discussion (Misc queries) | |||
clock | Excel Worksheet Functions | |||
Concatenate Function will not work | Excel Discussion (Misc queries) | |||
Using CONCATENATE function to create email addresses from a list | Excel Worksheet Functions |