Help with conditional move macro please !

eddy

Well-known Member
Joined
Mar 2, 2002
Messages
521
I am looking for help with a macro which will do the following:-

Look down Col C (From C12 TO C39).
Look for instances of TRAxxxxxx (9 characters xxxxxx are wild cards).
If present then I want to move the contents of that row (Cols B,C,D,E,F)
to Row 44.

e.g Search C12 to C39
Find TRANEW999 IN CELL C20
So move contents of B20,C20,D20,E20,F2O to B44,C44,D44,E44,F44

All help appreciated.

Thanks Ted
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Are you *sure* that's what you want to do?

If there are multiple instances, the values being moved to row 44 will just be written over with the next set of values. Basically you'll just end up with the values from the last instance found.
 
Upvote 0
Hi Kirsty.

I think that would be OK in this instance, there should never be more that one instance of TRAxxxxxx in the search area C12 to C39.


Ted
 
Upvote 0
One way:

Code:
Sub test()
Dim i As Long

For i = 12 To 39
   If Left(Cells(i, "C"), 3) = "TRA" Then
      Range(Cells(i, "B"), Cells(i, "F")).Cut Destination:=Range("B44")
   End If
Next i

End Sub
 
Upvote 0
Hi Kristy

That does exactly what I wanted it to do. Thank you so much, another little
snippit for the "macro archive".
Kind Regards Ted
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,251
Members
448,556
Latest member
peterhess2002

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