Combine 2 var into 1 string with & in between

bumbum2812

New Member
Joined
Sep 7, 2020
Messages
26
Office Version
  1. 365
Platform
  1. Windows
Hi Experts Please help me combine 2 var into 1 string with & in between.
My data is from A1:A2 & i have below code to put in MsgBox.

Rich (BB code):
 Sub abc() 
Dim lr3   As Long 
Dim var As Variant 
lr3 = Range("A" & Rows.Count).End(xlUp).Row 
For Each var In Sheets("Sheet1").Range("A1:A" & lr3)     
MsgBox var 
Next var
 End Sub

Any help will be so much apricated
 
Oops, missed the Not
VBA Code:
   If Not IsArray(Ary) Then
      txt = Ary
   ElseIf Len(Join(Ary, "&")) > 200 Then
      txt = "Multiple jobs"
   Else
      txt = Join(Ary, "&")
   End If
   .Subject = txt

You are god, Thank you Sir.
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,214,832
Messages
6,121,849
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top