Referencing a Worksheet

N

newguy

I am trying to insert data into a worksheet based on users input. I
want to get an input TodaysDate get its value and insert the data that
they put into the form into that worksheet which is named the same as
the Date. I have a workbook with 31 sheets for the corresponding 31
days in December and they will input the date on the form and I want it
to go to the worksheet with the same date. Here is my idea in code but
I need help making it work.

TodaysDate = Insertdata.Range("D2").Value
newwrksheet.Name = TodaysDate
 
D

Don Guillett

How about this idea where you just input a day number 1-31 in cell h2.
Assumes sheet name formatted as 12-09-06. This could be placed in a
worksheet change event to be automatic.

Sub gotodaysht()
If Range("H2") < 10 Then y = "0"
x = "12-" & y & Range("h2") & "-06"
Sheets(x).Select
End Sub
 
N

newguy

That will work but I am trying to make it so I dont need to up data the
code every month and with your method I will need to change the value
of the month every month. Also in your code is it setting x =
12-12-09-03 Since the value in Range h2 will equal 12-09 and you are
going to concatenate it with "12-" and "-06"

Thank you for your help
 
D

Don Guillett

As you can see and as I said, I designed it to put in 1-31. You can easily
change the code to input 12-09 if you like and change the x line
accordingly.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top