auto repeating the dates in specific cells in column by writing in two input box

leap out

Active Member
Joined
Dec 4, 2020
Messages
288
Office Version
  1. 2016
  2. 2010
Hi
I have about 12000 rows and there are many dates in column A
ZXC.xlsx
ABC
1DATE BATCHQTY
201/01/2023AT-0012900
302/01/2023AT-0021300
403/01/2023AT-0031200
504/01/2023AT-0045000
605/01/2023AT-00567788
706/01/2023AT-0069000
807/01/2023AT-0075666
908/01/2023AT-0081222
1009/01/2023AT-009123
1110/01/2023AT-010678
date

what I want when I write the cells using comma, colon in first input box like this
IN1.PNG

after click ok I will show the second inputbox to write date like this
in2.PNG









result should change the dates in cells for column A
ZXC.xlsx
ABC
1DATE BATCHQTY
217/01/2024AT-0012900
317/01/2024AT-0021300
417/01/2024AT-0031200
504/01/2023AT-0045000
617/01/2024AT-00567788
706/01/2023AT-0069000
807/01/2023AT-0075666
908/01/2023AT-0081222
1017/01/2024AT-009123
1110/01/2023AT-010678
date

I have this code I would add some line to adapt with my requirement with the same condition as in original code but for two inputboxes
VBA Code:
Sub enter_date()
Dim result As String
    result = InputBox("Enter the cells please", "cells Confirmation")
    If StrPtr(result) = 0 Then
        MsgBox ("User canceled!")
    ElseIf result = vbNullString Then
        MsgBox ("User didn't enter anything!")
    Else
        MsgBox ("User entered " & result)
    End If
End Sub
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Try:
VBA Code:
Sub RepeatDates()
    Application.ScreenUpdating = False
    Dim sDate As String, sRange As String, v As Variant, i As Long
    sRange = InputBox("Please enter the range separated by commas.")
    If sRange = "" Then Exit Sub
    v = Split(sRange, ",")
    sDate = InputBox("Please enter the date to repeat.")
    If sDate = "" Then Exit Sub
    For i = LBound(v) To UBound(v)
        Range(v(i)) = sDate
    Next i
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,620
Latest member
dsubash

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