Help with changing code

redspanna

Well-known Member
Joined
Jul 27, 2005
Messages
1,476
Office Version
  1. 2016
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?
 

Some videos you may like

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

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

Watch MrExcel Video

Forum statistics

Threads
1,122,483
Messages
5,596,405
Members
414,064
Latest member
Duncthegreat

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
Top