multi cell if_copy VBA

kris.small

New Member
Joined
Jul 13, 2011
Messages
12
okay so i have:
Sub Copy_If_2()<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
Dim lngNextDestRow As Long<o:p></o:p>
Dim rngRowItems As Range, c As Range<o:p></o:p>
<o:p></o:p>
With Worksheets("Master input table")<o:p></o:p>
If .Range("R6:R500, Arrests").Value = True Then<o:p></o:p>
Set rngRowItems = .Range(" ")<o:p></o:p>
End If<o:p></o:p>
With Worksheets("Arrests")<o:p></o:p>
lngNextDestRow = .Cells.Find(What:="*", after:=.Range("A1"), _<o:p></o:p>
SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1<o:p></o:p>
For Each c In rngRowItems<o:p></o:p>
.Cells(lngNextDestRow, c.Column) = c.Value<o:p></o:p>
'c.ClearContents 'option to "move" instead of copy<o:p></o:p>
Next c<o:p></o:p>
End With<o:p></o:p>
End With<o:p></o:p>
<o:p></o:p>
Set rngRowItems = Nothing<o:p></o:p>
Set c = Nothing<o:p></o:p>

End Sub

im not sure it it's possible to get it to do something like this.

if R6 , Arrest = true, then Copy A6,B6,C6,D6,R6,S6 to sheet "Arrests".

but i need it to do that for every Colume in R if it = Arrests

basiclly in Colum R i have 5 different avalible entries, each one needs to be moved to a different sheet, arrests, discharge, admit, called off, Transport.

QUESTION
how do i get my macro to copy A,B,C,D,E,F,G(6) if R6 = _____ (arrest in this case)

dont know if it helps by my work is old school and working with 2003 excel.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Thank you, see that's why I post stuff here you guys seem to know all the fun toys in excel again thanks it should work perfectly
 
Upvote 0
So i tryed the excel explosion and it works but doesn't save the data.... kinda frustrating and it's not really user friendly which is kinda the point of this program... so seeking other option....

I have a part of the coding i need done if someone with a larger brain then me could help finish it that would be amazing...

so...

Sub Copy_If_2()<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
Dim lngNextDestRow As Long<o:p></o:p>
Dim rngRowItems As Range, c As Range<o:p></o:p>
<o:p></o:p>
With Worksheets("Master input table")<o:p></o:p>
If .Range("R6:R500").Value = "Arrest"
Set rngRowItems = .Range("A6,B6,C6,D6,E6,F6,G6,J6,k6,l6,M6,R6,S6,T6,U6,X6")<o:p></o:p>
End If<o:p></o:p>
With Worksheets("Arrest")<o:p></o:p>
lngNextDestRow = .Cells.Find(What:="*", after:=.Range("A1"), _<o:p></o:p>
SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row + 1<o:p></o:p>
For Each c In rngRowItems<o:p></o:p>
.Cells(lngNextDestRow, c.Column) = c.Value<o:p></o:p>
'c.ClearContents 'option to "move" instead of copy<o:p></o:p>
Next c<o:p></o:p>
End With<o:p></o:p>
End With<o:p></o:p>
<o:p></o:p>
Set rngRowItems = Nothing<o:p></o:p>
Set c = Nothing<o:p></o:p>
End Sub<o:p></o:p>



So that is what i have, but the problem i run into is i don't need it to just copy row 6, i need it to copy whatever row an "Arrest" in column R is found...

R151 = Arrest. Move Rown 151 to page "Arrest"
So on and so forth... if it's not an option or not really avalible to do so and aditional Add-ons anyone can think of?

thanks K
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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