1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Pretty Simple VBA question

Discussion in 'Business Applications' started by picklepuss, Mar 31, 2010.

Thread Status:
Not open for further replies.
  1. picklepuss

    picklepuss Thread Starter

    Joined:
    Mar 25, 2010
    Messages:
    8
    I'm sure this is very simple, but since I am self-taught there are tremendous holes in my VBA knowledge.

    I have a macro that does several things, including entering a second section on a spreadsheet (so the row location of that section's header will be variable). In the second section header, I need to define a cell for input box data to go into.

    What is the best way for me to define a variable cell so that it becomes where the data from the input box (later in the macro) will go?

    e.g. (this does not work but shows what I am looking for)
    Dim DateCell As Range
    ActiveCell = DateCell

    **other stuff happens in macro**

    Dim Dateinput As Date
    Dateinput = InputBox ("What date is it? (m/d/yyyy)")
    MyDate = Dateinput
    Range("DateCell").Value = MyDate

    Thanks for any help!!!
     
  2. picklepuss

    picklepuss Thread Starter

    Joined:
    Mar 25, 2010
    Messages:
    8
    Was able to solve myself -

    Dim DateCell As String
    DateCell = ActiveCell.Address

    **other stuff**

    Dim Dateinput, MyDate As Date
    Dateinput = InputBox("What date is it? (m/d/yyyy)")
    MyDate = Dateinput
    Range(DateCell).Value = MyDate
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/913848

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice