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

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
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,116
Messages
6,134,730
Members
449,886
Latest member
MD SHIBLI NOMAN NEWTON

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