Timesheet VBA

andycrowh

New Member
Joined
Aug 28, 2022
Messages
3
Platform
  1. Windows
Hi there,

I am currently working on a timesheet and need it to do the below before I can send to colleagues to use:

- Column A reads the date in Column B and shows it as a day =TEXT(B9,"dddd") - what would I add that if the cell in Column B is empty nothing shows
- I have a command button that when clicked I want A1:G64 to save as PDF and ask the user where they would like it saved, the name of the PDF file needs to be "B5 Timesheet D7 to F7"

When users fill out the Userform it places a From and To date in the spreadsheet, I want Column B from B9 to populate all dates from the from date to the to date.

Please help
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
hi,
something like this maybe

VBA Code:
    Dim FromDate        As Date, ToDate As Date
    Dim NoDays          As Long
   
    FromDate = DateValue(Me.TextBox1.Value)
    ToDate = DateValue(Me.TextBox2.Value)

    NoDays = ToDate - FromDate + 1
   
    With Range("B9")
        .Value = FromDate
        .Resize(NoDays).DataSeries Rowcol:=xlColumns, Type:=xlChronological, _
                                   Date:=xlDay, Step:=1, Stop:=ToDate, Trend:=False
    End With

Adapt code to meet specific project need as required

Dave
 
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,794
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top