EhcacommenceVBAhum
New Member
- Joined
- Sep 3, 2017
- Messages
- 1
Hi everyone !
Thanks to anyone affording time to read this and possibly help
Here is my issue :
I'd like to copy data from a filtered column, then paste it to a filtered column in a different sheet, or even a different workbook.
I have a macro that works perfectly well to do that in single sheet. But excel crashes if I try to use it to paste in a different sheet or workbook.
Any idea of a way around ?
Scenario : Some cells in a column with header "Count 1" in Sheet 1 contain umerical values. This column filtered so that blank cells aren't visible.
I'd like to copy visible cells from "Count 1" of Sheet 1 and paste them in a column with header "Count 1" of another sheet where different rows are filtered.
Again, any solution working for different sheets would be awesome, but any solution solution working for different workbooks would be even better !
Here the code I use that only works in a single sheet (and therefore for ranges with same hiden rows) :
Thanks again for your time !
Thanks to anyone affording time to read this and possibly help
Here is my issue :
I'd like to copy data from a filtered column, then paste it to a filtered column in a different sheet, or even a different workbook.
I have a macro that works perfectly well to do that in single sheet. But excel crashes if I try to use it to paste in a different sheet or workbook.
Any idea of a way around ?
Scenario : Some cells in a column with header "Count 1" in Sheet 1 contain umerical values. This column filtered so that blank cells aren't visible.
I'd like to copy visible cells from "Count 1" of Sheet 1 and paste them in a column with header "Count 1" of another sheet where different rows are filtered.
Again, any solution working for different sheets would be awesome, but any solution solution working for different workbooks would be even better !
Here the code I use that only works in a single sheet (and therefore for ranges with same hiden rows) :
Code:
Sub Copy_Paste_Visible_Cells_Only()
Dim rngtocopy As Range
Dim rngtopasteto As Range
Dim cell As Range
Dim ccount As Long
Dim i As Long
On Error Resume Next
Application.DisplayAlerts = False
Set rngtocopy = Application.InputBox("Select the filtered range to copy !", "Select Filtered Cells", Type:=8)
If rngtocopy Is Nothing Then Application.DisplayAlerts = True: Exit Sub
Set rngtopasteto = Application.InputBox("Select the destination cell to paste to !", "Select Paste Destination", Type:=8)
If rngtopasteto Is Nothing Then Application.DisplayAlers = True: Exit Sub
On Error GoTo 0
Application.DisplayAlerts = True
ccount = rngtocopy.Columns.Count
For Each cell In rngtocopy.Columns(1).SpecialCells(xlCellTypeVisible)
Do
i = i + 1
Loop Until Not rngtopasteto(1).Offset(i).EntireRow.Hidden
rngtopasteto(1).Offset(i).Resize(1, ccount).Value = cell.Resize(1, ccount).Value
Next
End Sub
Thanks again for your time !