Copy and paste visible cells on every other cell in a column

geh17

New Member
Joined
Oct 8, 2015
Messages
4
Hi guys,

Hope you can provide some help with vba. Each visible cell in a column will be copied and pasted on every other cell in a column in another sheet. For example, after filtering cells on sheet1, visible cells that will be copied are A3, A10, A14, A19, A27, etc. Each of these visible cells will be pasted one by one on every other cell in sheet2 column B which starts on B1 then B3, B5, B7, B9, and so on. Thank you so much.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,671
Office Version
  1. 365
Platform
  1. Windows
How about
Rich (BB code):
Sub geh17()
   Dim Rng As Range, Cls As Range, Cl As Range
   Dim i As Long
   
   With Sheets("Sheet1")
      Set Rng = .Range("A2", .Range("A" & Rows.Count).End(xlUp)).SpecialCells(xlVisible)
   End With
   With Sheets("Sheet2")
      For Each Cls In Rng.Areas
         For Each Cl In Cls
            i = i + 1
            .Cells(i * 2 - 1, 1) = Cl
         Next Cl
      Next Cls
   End With
   
End Sub
change sheet names to suit
 

geh17

New Member
Joined
Oct 8, 2015
Messages
4
How about
Rich (BB code):
Sub geh17()
   Dim Rng As Range, Cls As Range, Cl As Range
   Dim i As Long
  
   With Sheets("Sheet1")
      Set Rng = .Range("A2", .Range("A" & Rows.Count).End(xlUp)).SpecialCells(xlVisible)
   End With
   With Sheets("Sheet2")
      For Each Cls In Rng.Areas
         For Each Cl In Cls
            i = i + 1
            .Cells(i * 2 - 1, 1) = Cl
         Next Cl
      Next Cls
   End With
  
End Sub
change sheet names to suit


Thank you very much @Fluff!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,671
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback
 

Watch MrExcel Video

Forum statistics

Threads
1,129,820
Messages
5,638,521
Members
417,031
Latest member
SEAN004

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
Top