popup to select row, then concatenate

solidENM

Board Regular
Joined
Feb 23, 2017
Messages
87
Hello,
I have a spreadsheet that has multiple columns of data. I need a macro that will prompt the user to select a row, then concatenate the info into another cell. The point of this is so the data can be copied, and pasted into a label maker. This label printer only prints from its standalone app.

I need help with the beginning
* message box - select row
* copies C, F, G, H, B, I
- pastes to cell O.


from there, i can handle the rest-- copy, paste as value, edit text size, copy. message box -- paste into printer app. I can probably figure out later how to print to the label maker directly from excel, but for not I am fine with a message box to select row, then telling user to paste into the other app.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Amend string to match your own needs (cell values delimited with line break in example below)

Code:
Sub CopyRow()
     Dim r As Long, Col, arr, cellStr As String
     arr = Split("F,G,H,B,I", ",")
     r = Application.InputBox("Select cell in row and click OK", , , , , , , 8).Row
     cellStr = Range("C" & r)
     For Each Col In arr
        cellStr = cellStr & Chr(10) & Range(Col & r)
    Next
    Range("O" & r) = cellStr
End Sub
 
Upvote 0
Amend string to match your own needs (cell values delimited with line break in example below)

Code:
Sub CopyRow()
     Dim r As Long, Col, arr, cellStr As String
     arr = Split("F,G,H,B,I", ",")
     r = Application.InputBox("Select cell in row and click OK", , , , , , , 8).Row
     cellStr = Range("C" & r)
     For Each Col In arr
        cellStr = cellStr & Chr(10) & Range(Col & r)
    Next
    Range("O" & r) = cellStr
End Sub


Works beautifully,
thank you very much! I like how it allows the user to select any cell in the row.
 
Upvote 0

Forum statistics

Threads
1,214,622
Messages
6,120,572
Members
448,972
Latest member
Shantanu2024

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