Automatically move Row to another sheet

RattlingCarp3048

Board Regular
Joined
Jan 12, 2022
Messages
166
Office Version
  1. 365
Platform
  1. Windows
You all have been so helpful in learning VBA so I am back again!

I need a code that basically says if Column T >/= 10 on Sheet 1, move the entire row to next available row on Sheet 2.

Headers are in Row 1 and are exactly the same on both sheets.

Value in Column T is formula based (=IF(S2-R2<0,"",S2-R2)).

I tried to record myself but couldn't quite figure out how to manipulate it to move the entire row.
 
Good morning Joe4, can I bother you again?

So I took the looping code you gave me last week from above and attempted to modify it for another project to transfer entire row to another sheet based on date. Not sure where I went wrong. I think im close but not sure Can you help out again? As-is the modified code is moving the entire worksheet to the Archive.

Attempting to: if column P on sheet 1 is older than 60 days, copy/paste entire row over to bottom of sheet 2, then delete the row from sheet 1.

This is how I modified it:

View attachment 55408
I think you may have your logic backwards. Remember, when dealing with negative numbers, the bigger the negative number is, the less it is (-70 is less than -60).
So I think you may actually want "<= -60", not ">= -60".
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
I think you may have your logic backwards. Remember, when dealing with negative numbers, the bigger the negative number is, the less it is (-70 is less than -60).
So I think you may actually want "<= -60", not ">= -60".
hhhmmm nothing happened at all. no error, debug, glitches, nothing.
 
Upvote 0
I think you may have your logic backwards. Remember, when dealing with negative numbers, the bigger the negative number is, the less it is (-70 is less than -60).
So I think you may actually want "<= -60", not ">= -60".
Soo Ive tried tweaking it a few different ways with no progress. It is either doing nothing at all or moving the entire sheet 1 over to sheet 2. Any thoughts?
 
Upvote 0
Are your values in column really numbers, or are they numbers entered as text?
You can use the ISNUMBER function on one of the values to test it out, i.e.
Excel Formula:
=ISNUMBER(P4)
 
Upvote 0
Are your values in column really numbers, or are they numbers entered as text?
You can use the ISNUMBER function on one of the values to test it out, i.e.
Excel Formula:
=ISNUMBER(P4)
so, it was originally a date/time combo brought in from another report. I removed the time and formatted the cells to be a date as mm.dd.yyyy.

=isnumber function showed true.
 
Upvote 0
so, it was originally a date/time combo brought in from another report. I removed the time and formatted the cells to be a date as mm.dd.yyyy.

=isnumber function showed true.
But the formula you wrote does NOT check to see how far in the past a date may be. It is not doing any mathematical calculation on column P, it is just looking at the value, i.e.
Rich (BB code):
If ws1.Cells(r, "P").Value >= -60 Then

If you want to see if the date in column P is more than 60 days in the past, then you need to compare it to the current date, i.e.
Rich (BB code):
If Date - ws1.Cells(r, "P").Value >= 60 Then
 
Upvote 0
But the formula you wrote does NOT check to see how far in the past a date may be. It is not doing any mathematical calculation on column P, it is just looking at the value, i.e.
Rich (BB code):
If ws1.Cells(r, "P").Value >= -60 Then

If you want to see if the date in column P is more than 60 days in the past, then you need to compare it to the current date, i.e.
Rich (BB code):
If Date - ws1.Cells(r, "P").Value >= 60 Then
Thats what i was missing!! i knew i was super close LOL Thanks.
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,550
Members
449,088
Latest member
davidcom

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