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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
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,221,519
Messages
6,160,298
Members
451,636
Latest member
ddweller151

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