Solved

Textbox populate

Posted on 2014-01-21
3
159 Views
Last Modified: 2014-01-21
Trying to get TextBox2 to read "Valid From: dd-mmm-yyyy hh:mm to dd-mmm-yyyy hh:mm +12 hours EST.  You would be adding 12 hours to the current time.

 An example would be "Valid From 19-Jan-2014 14:00 to 20-Jan-2014 02:00 EST"


Sheet18.TextBox2.Value = "Valid From: " & Format(Now(), "dd-mmm-yyyy hh:MM:ss") & " EST"
0
Comment
Question by:sandramac
3 Comments
 
LVL 29

Expert Comment

by:IrogSinta
ID: 39799020
Try this:
Sheet18.TextBox2.Value = "Valid From: " & Format(DateAdd("h", 12, Now()), "dd-mmm-yyyy hh:MM:ss") & " EST"

Open in new window

Ron
0
 
LVL 33

Accepted Solution

by:
Norie earned 500 total points
ID: 39799052
If it's an ActiveX textbox.
    Sheet18.TextBox2.Value = "Valid From: " & Format(Now(), "dd-mmm-yyyy hh:MM:ss") & " to " & Format(Now() + TimeSerial(12, 0, 0), "dd-mmm-yyyy hh:MM:ss") & " EST"

Open in new window


If it's a Forms textbox.
Dim txt As Object

    Set txt = Sheet18.Shapes("TextBox2").OLEFormat.Object
    txt.Text = "Valid From: " & Format(Now(), "dd-mmm-yyyy hh:MM:ss") & " to " & Format(Now() + TimeSerial(12, 0, 0), "dd-mmm-yyyy hh:MM:ss") & " EST"

Open in new window


By the way, if the text won't change you might want to consider a label instead of a textbox.
0
 

Author Closing Comment

by:sandramac
ID: 39799115
Thanks
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now