Solved

Textbox populate

Posted on 2014-01-21
3
161 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

772 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