Help with changing code

redspanna

Well-known Member
Joined
Jul 27, 2005
Messages
1,602
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

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Try

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

Forum statistics

Threads
1,215,373
Messages
6,124,553
Members
449,170
Latest member
Gkiller

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