VBA Script when removing row to a new sheet

Ian Denney

New Member
Joined
Sep 16, 2024
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have an excel spreadsheet where if I enter Yes into column F ("Remove From finder") on the "Finder" Sheet the row will be moved automatically to the next empty row on the Sheet Labeled "Removed". See attached screen shot.
Screenshot 2024-09-20 110213.png


I have a VBA script (see attached screen shot) that should do this. However, I find that it will paste the removed row into a random row e.g. instead of say row 4 (the next empty row it will randomly paste into say row 443 etc.

Can anyone suggest what may be causing this in the VBA script?



Thanks in advance for any help.

Ian
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Hi,

I have an excel spreadsheet where if I enter Yes into column F ("Remove From finder") on the "Finder" Sheet the row will be moved automatically to the next empty row on the Sheet Labeled "Removed". See attached screen shot. View attachment 117086

I have a VBA script (see attached screen shot) that should do this. However, I find that it will paste the removed row into a random row e.g. instead of say row 4 (the next empty row it will randomly paste into say row 443 etc.

Can anyone suggest what may be causing this in the VBA script?



Thanks in advance for any help.

Ian
and where is the script...
 
Upvote 0
The script is in the Finder tab on the spreadsheet
There are 2 tabs in the spreadsheet: "Finder" and "Removed". I want to move rows from Finder to Removed based on the value in column F (removed from finder) on Finder tab to the next vacant row in the Removed sheet
 
Upvote 0
The problem is when data ready to copy to "Removed" sheet it takes last row from "Finder" sheet, if last row from "Finder" sheet is 200 then it will copy to "Removed" sheet in row 200 too, change this :

VBA Code:
Lastrow = Sheets("Finder").Cells(Rows.Count, "F").End(xlUp).Row + 1

to :

Code:
Lastrow = Sheets("Removed").Cells(Rows.Count, "F").End(xlUp).Row + 1
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,117
Members
453,021
Latest member
Justyna P

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