VBA conditional line insert using date format

lakeside park

New Member
Joined
Mar 8, 2023
Messages
3
Office Version
  1. 2007
Platform
  1. Windows
Hi
See some great solutions offered here. Wonder if you can help me

I have a spreadsheet with columns of mixed data. I want to search thru column C which is in date format dd/mm/yyyy and insert a line when my input date (input using an InputBox or some form I have to create) is greater than or equal to a date in the column. So if my input date = 2/21/2030 a line would be inserted into the table just after 2/21/2029 and before 2/21/2031, the "input_line". Then I would want to fill the line with a color so I know where the line was inserted and write the input date into cell C:input_line.

I need to populate the line with other input data but I can probably figure that out from the code sample provided and I need to do this on 3 different worksheets in the same file.

Thanks for your help
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi,
From your description ... aren't you just after sorting your database after a new row has been added ?
 
Upvote 0
I have tried typing a repyi a few times and something seemed to happen to the reply so if more than one reply shows up I apologize for that - using a borrowed laptop.

thank you for your reply. you point is a good one. i think you are saying just inert a line with the new input anywhere then sort based on the date. I understand the idea. my thoughts are that the 3 worksheets i have to enter this input data are different formats with different rows to be sorted and additional data that cannot be sorted (not all columns would be sorted on one worksheet for example). I am tryiing to automate inserting this data in 3 different worksheets at the same time. but as you can tell by your great suggestion - i may be overthinking this and simple is better. I have 0 experience with macros and VBA and originally thought of using python or C to do it and then read about VBA.

Not sure from your suggestion if I should try doing this with recording a macro or I still need to write some VBA code

Thanks again
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,178
Members
449,071
Latest member
cdnMech

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