Why Is My Loop Not Repeating Correctly?

CP1880

New Member
Joined
Mar 6, 2018
Messages
1
I'd definitely appreciate any insight into my problem. Newbie here to VBA but learning quick. My problem is the following: I'm trying to cut & paste a range into some data that has been autofiltered. I'd like the loop to paste until there is no longer data in column A. Right now it only pastes twice. I'm sure it's an obvious answer but right now I can't see the forest from the trees. Thanks in advance!!

Code:
[INDENT]Selects Over and Down. Applies filter to select only CCV.
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).<wbr>Select
Range(Selection, Selection.End(xlDown)).Select
Selection.AutoFilter Field:=2, Criteria1:= _
"=??????????[CCV]", Operator:=xlAnd
 
'Copies and Pastes CCV formula
Windows("Template.xls").<wbr>Activate
Range("E246:J306").Select
Selection.Copy
Windows("CURRENTDATA.xls").Activate
   
'Moves Cursor to Column E First Empty Cell and Pastes CCV Formula
ActiveSheet.AutoFilter.Range.<wbr>Offset(1).SpecialCells(<wbr>xlCellTypeVisible).Cells(1, 5).Select
ActiveSheet.Paste
 
'Moves Cursor Down to First Empty Cell in Column E and Pastes CCV Formulas
ActiveCell.Offset(61, 0).Activate
Do While ActiveCell.EntireRow.Hidden = True
ActiveCell.Offset(61, 0).Activate
Loop
ActiveSheet.Paste
Do Until IsEmpty(ActiveCell.Value)
        ActiveCell.Value = ActiveCell.Value * 2
        ActiveCell.Offset(1, 0).Select
    Loop
End Sub
[/INDENT]
 
Last edited by a moderator:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

Forum statistics

Threads
1,215,578
Messages
6,125,642
Members
449,245
Latest member
PatrickL

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