Help with changing code

redspanna

Well-known Member
Joined
Jul 27, 2005
Messages
1,604
Office Version
  1. 365
Platform
  1. Windows
Hi all,

A while back I was given lots of help to write some code that searches though column B of my "Bank Statement" sheet for certain text strings.
If a match is found then the matching string's value in column C is copied into the next available row in a given column...
Code:
Sub Sort()

Sheets("Bank Statement").Select
Range("C:C").Select
    Selection.Replace What:="-", Replacement:="", LookAt:=xlPart, _
        SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
        Range("E1").Select
        
   Set myCell = Sheets("Bank Statement").Range("B:B").Find(What:="*cash out*") ' Cash Withdrawals
While Not myCell Is Nothing
   myCell.Offset(0, 1).Copy Range("AG65536").End(xlUp)(2)
   myCell.clear
   Set myCell = Range("B:B").FindNext
Wend
so for example the above searches for the text string "cash out" then copies that value from column C into next available in column AG, then deletes the copied value from column C

What I want to do is change the paste function so that it copies the found value (column C) and then places it instead of the next available cell in column AG but the next available cell in ROW25

any ideas please?
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Try

Code:
 myCell.Offset(0, 1).Copy Cells(25, Columns.Count).End(xlToLeft).Offset(, 1)
 
Upvote 0

Forum statistics

Threads
1,224,596
Messages
6,179,802
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