W
WBTKbeezy
Hello:
I was trying to find a way to paste into visible cells only. I found a macro
on another site and have pared it down to the following:
Sub VisbleCellsPasting()
On Error Resume Next
Dim aRng As Range
Dim aRn As Range
Dim bRng As Range
Set aRng = ActiveSheet.Range("B234:B273")
Range("F2").Select
For Each aRn In aRng
Set bRng = ActiveCell
If bRng.EntireRow.Hidden = False Then
bRng = aRn
bRng.Offset(1).Select
Else
Do
If ActiveCell.EntireRow.Hidden = True Then
ActiveCell.Offset(1).Select
End If
Loop Until ActiveCell.EntireRow.Hidden = False
ActiveCell = aRn
ActiveCell.Offset(1).Select
End If
Next
End Sub
This code works fine, but I have some issues...
The macro hard codes the selection that I need to paste and where I need to
paste it. I would like to be able to use the normal Excel copy (Ctrl+C) on my
data I need to paste (where ever it lives whether in a new workbook or not)
and click the macro button and have it paste where I need it. Is this
possible?
I was trying to find a way to paste into visible cells only. I found a macro
on another site and have pared it down to the following:
Sub VisbleCellsPasting()
On Error Resume Next
Dim aRng As Range
Dim aRn As Range
Dim bRng As Range
Set aRng = ActiveSheet.Range("B234:B273")
Range("F2").Select
For Each aRn In aRng
Set bRng = ActiveCell
If bRng.EntireRow.Hidden = False Then
bRng = aRn
bRng.Offset(1).Select
Else
Do
If ActiveCell.EntireRow.Hidden = True Then
ActiveCell.Offset(1).Select
End If
Loop Until ActiveCell.EntireRow.Hidden = False
ActiveCell = aRn
ActiveCell.Offset(1).Select
End If
Next
End Sub
This code works fine, but I have some issues...
The macro hard codes the selection that I need to paste and where I need to
paste it. I would like to be able to use the normal Excel copy (Ctrl+C) on my
data I need to paste (where ever it lives whether in a new workbook or not)
and click the macro button and have it paste where I need it. Is this
possible?