In Macros, Concatenate in cell p: c1, "_",b1,"_",d1 then save as cell p and close

metricsboy

New Member
Joined
Dec 10, 2012
Messages
28
1712948330165.png
 

Attachments

  • 1712948282303.png
    1712948282303.png
    60.1 KB · Views: 4

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
VBA Code:
Sub test()
Range("P1") = Range("C1") & "_" & Range("B1") & "_" & Range("D1")
ThisWorkbook.Close (True)
End Sub
 
Upvote 0
I am getting this error. I am just doing the concatenation in p1, copying and pasting value in p1, then adding your code.

1712952755054.png
 
Upvote 0
You didn't say all that in your original question. But you can't add a sub within a sub. You look like you're already doing some sort of concatenation???
Not exactly sure what you need now exactly, but you'll have to take my Sub test() and End Sub lines out for sure.

ThisWorkbook.Close(True) is the line that closes and saves the workbook.
 
Upvote 0

Forum statistics

Threads
1,217,156
Messages
6,134,943
Members
449,899
Latest member
stanew

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