Copy Paste on TextBox based on TODAY Date

Attrazion

New Member
Joined
Mar 11, 2023
Messages
25
Office Version
  1. 365
Platform
  1. Windows
Hi Everyone,

I just want to ask for a help regarding my problem on VBA Macro.

So I have 3 sheets which contains Date and Name.

Now, I need to display the Name of the person on a TextBox vertically based on what date today automatically once I run the macro.

Ex. The Date today is March 11, 2023 So the output will be like this on TextBox.

Howard
Howard 8
Howard 3

1678519929359.png


Book1
ABC
1DateName
203/05/2023Adrian Santos
303/06/2023Adrian Sanchez
403/06/2023Ranch Book
503/07/2023Auto Sum
603/08/2023Fernandez
703/09/2023Tolentino
803/10/2023Loti
903/11/2023Howard
1003/12/2023Duke
11
12
Sheet1


Book1
ABCDEF
1DateName
203/05/2023Adrian Santos 1
303/06/2023Adrian Sanchez 2
403/06/2023Ranch Book 3
503/07/2023Auto Sum 4
603/08/2023Fernandez 5
703/09/2023Tolentino 6
803/10/2023Loti 7
903/11/2023Howard 8
1003/12/2023Duke 9
11
12
Sheet2



Book1
ABCDEFG
1DateName
203/05/2023Adrian Santos 10
303/06/2023Adrian Sanchez 9
403/06/2023Ranch Book 8
503/07/2023Auto Sum 7
603/08/2023Fernandez 6
703/09/2023Tolentino 5
803/10/2023Loti 4
903/11/2023Howard 3
1003/12/2023Duke 2
11
12
Sheet3
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi,
The basic idea is
1. to have a formula, say in cell D2
Excel Formula:
=INDEX(B:B,MATCH(TODAY(),A:A,0))
2. in your textbox, use the Linked Cell property with, e.g. D2

Hope this will help
 
Upvote 0
Hi,
The basic idea is
1. to have a formula, say in cell D2
Excel Formula:
=INDEX(B:B,MATCH(TODAY(),A:A,0))
2. in your textbox, use the Linked Cell property with, e.g. D2

Hope this will help
Hi, This one helps. But I need to run the user form and get the value based on what date is. Can you share some code using on TextBox?
 
Upvote 0
Hi again,

Have to assume that whenever you do launch your UserForm, you are using UserForm_Initialize()
For example, following instruction can be inserted :
VBA Code:
Me.TextBox1.Value = Sheet2.Range("D2")
 
Upvote 0
Hi again,

Have to assume that whenever you do launch your UserForm, you are using UserForm_Initialize()
For example, following instruction can be inserted :
VBA Code:
Me.TextBox1.Value = Sheet2.Range("D2")
Hi,
Please excuse my ignorance, I'm new on learning VBA.
I pasted the code you given below and this is the results. Is there any code changes I need to do?
1678523934045.png


1678523955484.png
 
Upvote 0
HI again,

It could be that, for your List Separator, your Regional settings are using the semicolon ...(and not the comma)
=INDEX(B:B;MATCH(TODAY();A:A;0))

A quick remark for your VBA instruction :
Me.TextBox1.Value = Sheet2.Range("D1")
 
Upvote 0
HI again,

It could be that, for your List Separator, your Regional settings are using the semicolon ...(and not the comma)
=INDEX(B:B;MATCH(TODAY();A:A;0))

A quick remark for your VBA instruction :
Me.TextBox1.Value = Sheet2.Range("D1")
This is working now, thanks! My only problem is when I type the 03/11/2023 on Date field it will display a results of #NA but when I change it using =TODAY() it work. Also do you know how to add a new line on text box? I mean when I copied and paste the data on TextBox form, it pasted on horizontally and I need to paste it on vertically. Thanks!
 
Upvote 0

Forum statistics

Threads
1,215,111
Messages
6,123,152
Members
449,098
Latest member
Doanvanhieu

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