VBA loop

Summerso1

New Member
Joined
Jul 24, 2014
Messages
45
Hi I'm trying to do a VBA loop for copying B6 pasting it to L4 and then copying K2 to C6, then doing the same again but copying from B7 pasting it to L4 and then copying K2 to C7

the bold numbers are the ones that I want to copy/paste next to after these would be copy from B8............C7

I have this so far put I really need it to loop untill there are no more values in column B

thank you!!:eek:

Range("B6").Select
Selection.Copy
Range("L4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Calculate
Range("K2").Select
Selection.Copy
Range("C6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("B7").Select
Application.CutCopyMode = False
Selection.Copy
Range("L4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Calculate
Range("K2").Select
Selection.Copy
Range("C7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
I have a question for you. Are you sure you have those paste to and paste from correct? What's the benefit of overwriting L4 every time? And then you're autopopulating column C with the value from K2 over and over? Just double checking.
 
Upvote 0
Perhaps.
Code:
Set rng = Range("B6")

Do
    rng.Copy Range("L4")

    Calculate

    Range("K2").Copy rng.Offset(,1)

    Set rng = Rng.Offset(1)

Loop Until rng.Value = ""
 
Upvote 0
yes basically the K2 changes with every input to L4 if that makes sense so i need to recalculate every time I paste in to L4 before copying K2 sorry for the confusion! :)
 
Upvote 0
You didn't actually mention that.:)
Code:
Range("K2").Copy

rng.Offset(,1).PasteSpecial xlPasteValues
 
Upvote 0

Forum statistics

Threads
1,215,480
Messages
6,125,049
Members
449,206
Latest member
Healthydogs

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