Solved

Textbox populate

Posted on 2014-01-21
3
166 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 34

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

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,…
Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
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 on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

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