Copy visible cells as text (without formatting)

kev71986

New Member
Joined
Mar 3, 2016
Messages
1
Hi Guys

I've encountered a problem which seemed fairly easy to resolve and has now resulted in me tearing my hair out!

I have a worksheet which hides and shows cells based on user input, fairly simple, lots of code, but works well. At the bottom of the worksheet there is a button to "Copy Notes", which will allow the user to paste the aforementioned selections onto their systems.

I need this macro to only copy visible cells and their values, excluding the formatting. From playing around with the macro I decided to copy the visible cells, then paste the values from these visible cells elsewhere on the sheet. I would then require a code to copy cells which only contain data from the now pasted cells (unless anyone can think of anything easier?).

The code I currently have is;

Private Sub Commandbutton1_click()

Set rng = Sheets("Sheet1").Range("b2:q170")
rng.SpecialCells(xlCellTypeVisible).Copy
Worksheets("Sheet1").Range("b190").PasteSpecial xlPasteValues

'Notify User
MsgBox "Text notes have now been copied to your clipboard", vbInformation

End Sub

So from using my code I would then need a code which looks at the range B190:Q359 and only copies cells which contain data.

I think I've went the long way round for a shortcut, but would really appreciate any suggestions.

Thanks
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Could you re write it and just loop through the range and assign the value to the target cell if it wasn't empty?
 
Upvote 0

Forum statistics

Threads
1,222,749
Messages
6,167,967
Members
452,158
Latest member
MattyM

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