JonRowland
Active Member
- Joined
- May 9, 2003
- Messages
- 416
- Office Version
- 365
- Platform
- Windows
The following code combines strings in Cols C&D per row.
I am looking to expand this and combine B,C &D when there is text in B. If not then just combine C&Dand thought I would alter to
This should be if B is blank then comine C&D
If B is not blank then combine B,C&D.
But this ends up with Type Mismatch error. Am I missing something or is this a method that can't be used?
Thanks
Jon
VBA Code:
With Range("C2:C" & Range("A" & Rows.Count).End(xlUp).Row)
.NumberFormat = "@"
.Value = Evaluate(.Offset(0, 0).Address & "&"",""&" & .Offset(, 1).Address)
End With
I am looking to expand this and combine B,C &D when there is text in B. If not then just combine C&Dand thought I would alter to
VBA Code:
With Range("B2:B" & Range("A" & Rows.Count).End(xlUp).Row)
If .Value = Empty Then
.NumberFormat = "@"
.Value = Evaluate(.Offset(0, 1).Address & "&"", ""&" & .Offset(, 2).Address)
Else
.NumberFormat = "@"
.Value = Evaluate(.Offset(0, 0).Address & "&"", ""&" & .Offset(, 1).Address & "&"", ""&" & .Offset(, 2).Address)
End If
End With
This should be if B is blank then comine C&D
If B is not blank then combine B,C&D.
But this ends up with Type Mismatch error. Am I missing something or is this a method that can't be used?
Thanks
Jon