Copy cell Next from Cell with Text "True"

Hjemmet

Board Regular
Joined
Jun 20, 2018
Messages
207
I need a Vba Code to control if one of those cell is "True"
i have try with this code but it aint work


Code:
Sub Copypast()'
' Copypast Makro


If Sheets("Copy").Range("D5").Text = "True" Then


    Sheets("Copy").Select
    Range("E5").Select
    Selection.Copy
    Sheets("Past").Select
    Range("G2").Select
    ActiveSheet.Paste
    End If
End Sub

So help Need
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Hey I try to Understand How it Realy Works


Now this code works For Looking on Colomn "D" and Copy from "E" so much understand i...

Code:
    p = 1 
For i = 2 To lastRow

but what is "P" for and then Number "1"
and then "For i = 2"


its because i try to make the same Function on another Colomn but its on "H" for True and "I" for Copy/past

but i would like to figure out How it was Working


NEVER MIND I CAME TO ME LIKE A HIT WITH A FLY SLAMMER..........By trying to change the Letters ()
 
Last edited:
Upvote 0
but what is "P" for and then Number "1"
and then "For i = 2"

this is called a "For Loop"
its basically saying "For every row past row 2 up until the lastRow"
so these variable "i" and "p" are what im using to define the row number
so where the code says

Code:
Range("D" & i)
that means the range of the cell Di (where i is the number of the current row the loop is on)
so that means the if you have 16 rows of data in column D it will check D2 to D16
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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