# Macro: Check CheckBox Is True, Current Date For Day/Month, Then Sum TextBox & Cell

May 28, 2008

I am trying to allow the Command Button when clicked to go through multiple conditions before making a decision. So, when someone clicks on Command Button 3 the code should look to see if CheckBox1 is true, then it should check today's date, and if it is between a range of days, or even months, then it would add the number in TextBox1 with the amount already in cell H18. This event will happen every time someone clicks on the Command Button.

The end result is to have several sheets (4 total) for each quarter in the fiscal year, and if the dates are within those parameters, the clicking of the command button will update the correct sheet.

## Date In IF Statement - Get True Result To Be First Of Given Month Of Current Year

Feb 29, 2012

I've got a formula that has numerous nested IF statement and am trying to get the true result to be the first of a given month of the current year. Here's my formula:

Code:
=IF(Setup!\$B\$3="X","1/1",IF(Setup!\$C\$3="X","2/1",IF(Setup!\$D\$3="X","3/1",IF(Setup!\$E\$3="X","4/1",
IF(Setup!\$F\$3="X","5/1",IF(Setup!\$G\$3="X","6/1",IF(Setup!\$H\$3="X","7/1",IF(Setup!\$I\$3="X","8/1",
IF(Setup!\$J\$3="X","9/1",IF(Setup!\$K\$3="X","10/1",IF(Setup!\$L\$3="X","11/1",IF(Setup!\$M\$3="X","12/1",""))))))))))))

Everything works, save that the cell becomes 1/1 with no year at all. I've messed around a bit with TEXT and various DATE/MONTH/YEAR functions on this one, but can't seem to get it correct.

## Finding Current Month Total Sales Using Current Month To Date Sales In Formula / Macro?

Aug 20, 2013

Basically, I'm doing a recorded macro for work where I take an export and manipulate the data to show differences between sales from last year and this year. Also comparing this months projected sales to avg of last 6 months and also against last years this month.

The problem I'm running into is in automating the this month sales for mid-month exports. I can do it individually but I can't find a formula that will do it. Data is in one cell per month, so ex. 130 sales this month so far. I need to have it convert that to projected sales for total month based on what day it currently is.

## Find TextBox Text In Worksheet If CheckBox Is True / Checked

Feb 24, 2008

I have a userform where the textbox already pulls data from a worksheet. I have a checkbox next to the textbox, If the checkbox is true it finds the textbox value on a worksheet and using Offset it inserts "yes" in the next cell.

## Macro To Save Files In New Folder With Current Month And Date

May 6, 2014

I have this existing macro which saves each tab into a separate excel file. However, I'd like for it to also save them together in a new folder using the current month and date (named: QA Files May_05.06.14). The month and date would change according to current month/date. How would I incorporate that into this code? I am not good with macros.

Sub tabname()
Dim ws As Worksheet
For Each ws In Worksheets
ws.Activate
ws.Name = Range("D1").Value
Next

[Code]...

## Check Cell Has Date & Insert Current Static Date

Jun 25, 2008

I have a user form that when a command button is clicked it enters the data from the from into coloums a,b,c,etc. I have code to do this but I want to add code to add a static date in coloum B based on if coloum A had data entered from the form. I need the date not to change to current date when the file is reopened. I am trying to elimate a date text box in the form. I have a link to the file http://www.box.net/shared/zdtsjv0qos

## Check Value Of Current TextBox

Jul 27, 2007

I am trying to produce a useform to allow me to input some golf scores into Excel.

Therefore, I have many textboxes for entering the score for each hole and to make the input process very efficient I am moving the focus to the next textbox automatically when a single digit score has been entered. Unfortunately, although I hate to admit it

I do now and then have a double digit score and so I have a Checkbox1 which allows me to enter scores >9 if checkbox1 =false.

I can use the code below to check if the score is less or greater than 10 but I will have to enter it into 18 textboxes and change the name of the textbox details from IF Textbox1.value <... to IF Textbox 2.value < etc. I will also have to change the text according to the name of the next tectbox to allow me to set the focus.

Can anyone please advise how I can check if the 'current' textbox (which has the focus) is less than or greater than 10 without needing to know the name of the textbox?

Also, can I obtain the name of Textbox1 so that I can set the focus to Textbox2 ie Textbox1+1?

As stated I can use my existing code but I am sure there must be a more elegent way of doing this and I am trying to learn a little about VBA.

Private Sub TextBox1_Change()

If TextBox1.Value < 10 And CheckBox1 = True Then
UserForm1.TextBox2.SetFocus
End If
If TextBox1.Value >= 10 And CheckBox1 = False Then
UserForm1.TextBox2.SetFocus
End If

End Sub

## Date Range Formula: Beginning Of Month To End Of Month (which Is In The Current Row)

Mar 20, 2009

I have log data in two columns:
Column A: Date/time (at 30 minute intervals)
Column B: Numeric data

On the last row of each month, I’m trying to perform a SumProduct on the two columns and display that result in column C.

The end of the range is determined by the month in the current row.

I’m having difficulty finding the beginning of the range, though. I need to account for both the normal dynamic calendar days & the fact that I may get data starting mid-day and mid-month.

I have this formula, but I’m not sure how to make the first array dynamic or if this is even correct approach.

Manual
=IF(OR(MONTH(A1009)=A4)*(A\$4:A\$65536

## Open Multiple Files, Check Current Month & Save To New Location

Sep 15, 2007

I have 40 files in one folder which I named it as "CA" + month's name that I am working on. I need to do analyse these files monthly and save it under new folder. how do I automatically save them in new folder and name them for that particular month. Also, each file has worksheet which has one cell as "Aug-07" and the cell next to it has number of that month that is "08". How do I automatically change this also based on the name of the file, because file name month and month in the cell are the same.

## Hide Checkbox TRUE/FALSE & Sum Values Adjacent To TRUE

Aug 2, 2009

I have a worksheet where I have around 300 rows, each with 7 columns. What I want to do is add a checkbox to each column. I plan on setting non-applicable checkboxes to mixed status and locking the worksheet. I will unlock applicable checkboxes and sumif or countif their value according to row-based scoring, for example, each checked checkbox represents a value of 3. I do not know VBA and have chose to use the form control checkboxes rather than ActiveX.

I believe that a formula for this would be something like: =SUMIF(B1:B3,True,"3") or =COUNTIF(\$B\$1:\$B\$3,True)*3

I am wondering firstly if I have that right and secondly if there is a way to stop my checkboxes from displaying labels. Currently, if I click on one it displays True behind the active checkbox. If I uncheck it, it displays False.

## Cell Act As True Or False Checkbox

Dec 11, 2009

I have some code for another project which was using checkboxes to select elements to copy/paste.

However, I need too many checkboxes and I think it is slowing down the run time.

I'm wondering if it's possible to have a cell act as a true/false checkbox?

Then I would just change my code from

if checkbox1.value = true then...

to

if range("A1").value = true then....

## Excel 2010 :: Userform Date Picker Textbox Will Not Select Current Date

Feb 10, 2012

I have userform with date pickers and have text boxes overlaid on these, when I select todays date from the date picker it does not display the current date in the text box (I have 8 date pickers on the userform). If I select another date then reselect the current date it works. It has occasionally worked but why.

Below is the code for populating the text box from the Date Picker.

Private Sub DTPicker1_Change()
TextBox1.Value = DTPicker1.Value
End Sub

The initialize userform code uses the following to format and set the textbox

Code:

TextBox1.Value = Format(Date, "dd-mmm-yy")
TextBox1.Value = ""

Windows 7 with Excel 2010

## Calculate Number Of Days Between Two Date Within A Current Month Including End Date

Apr 2, 2009

I have two columns of dates, leave start and end dates (when people start leave i.e. annual leave). Would need to introduce column(s) to calculate how many days fell within the month including the end date and excludes weekends.

For example, if the staff on leave from 31st March to 6 April, i need to show that the number of leave taken as 1 day in March and 4 days in April.

## Return Value To Cell Based On CheckBox TRUE/FALSE

Mar 12, 2008

I would like to create a qestionairre with checkboxes used to answer the question "Do you need____" (Check if yes). On the following workbook I would like a list of all items needed, and a list of items not needed on yet another workbook.

Is there a way to create these lists without having blanks for values that are not true? (and because Im sure there is HOW?)

## Check TextBox Date Higher Than Other TextBox Date

Aug 30, 2006

In a userform I have 2 textboxes date1 and date2 (data from calendar1 userform2). I want date2 always to be higher than date1.

## Find Value Corresponding To First Date In Current Month

May 27, 2009

i have a table with a row of dates along the top. beneath each date is a value.
the dates and values in these cells changes based on info in other sheets.

i need a way of finding the first date in the current month and returning the corresponding value.

## Macro To Check For True Value And Copy To Another Sheet

Oct 28, 2008

I need a macro that would sort out the true value in column A, and paste it to another sheet (range A77)

## Intersection Of Date Range And Current Month

Jan 9, 2007

I need to compute the number of days that a given range of dates has in common with any given month. So an example might be:

Cell A1: Range Start Date (say it's 1/1/07)

Cell A2: Range End Date (say it's 2/15/07)

Cell A3: Month Indicator (say it's 2, meaning February)

Cell A4: Days of Intersection (should be 15 in this case, meaning that 2/1-2/15 were the days of February that were also in the range 1/1-2/15)

Cell A4 is what I'm trying to create the formula for.

I'm in Excel 2000 and am having trouble installing the add-on.

## Get Month & Year X Months From Current Date

May 3, 2008

I am trying to get mmm-yy date format for the next 2 consecutive months from now. I used the following code for that reason, but I am not getting.

strDate = Format(DateAdd("m", 1, Date), "mmm-yy")

strDate = Format(DateAdd("m", 2, Date), "mmm-yy")

However if I use this, I get the current months date correctly (like May - 08)

strDate = Format(DateAdd("m", 0, Date), "mmm-yy")

## Shortcut Key To Place Current Date In UserForm TextBox

Aug 7, 2008

I have a Userform that allows users to add projects to a tracking sheet. If the project is a WIP, no 'Sign Off Date' needs to be entered. When the project is complete, I would like the user to be able to hit a shortcut key (while inside the user form, with the cursor in the 'Sign Off Date' textbox) to populate the 'Sign Off Date' textbox with today's date (i.e. like CTRL + ; does in Excel) rather than have to enter it manually.

## Check Textbox Date Contents?

Jul 23, 2012

I need to confirm that a date is entered correctly into a userform.

This code works for a command button, but not for a WorkSheet_Change event.

My textbox is the first in the userform, and needs to be checked immediately, as the labels in the rest of the userform all change to reflect the date that was entered.

What is the best way to do this? I tried a keycode = vbKeyReturn option, but cannot get it to work?

Code:
Private Sub DateCheck()
Dim DateString As String
Dim DateProper As Date
Dim EntryOK As Boolean
EntryOK = False

[code]....

## Check Whether Date Is A Month After Previous Date?

Dec 12, 2013

I'm sent a file every day where column A contains a month & year but in "general" format.

For example;

Column A, starting with cell A1 with the next date in A2, etc
Jan15
Feb15
Mar15
Apr15

Is there a way through a formula or macro that I can use in order to run through all the dates in this column to make sure that the next cell down is always the month after the cell above it? The dates go all the way through to 2018 in the above format.

## Check To See If Textbox Entry Qualifies For Date

Dec 8, 2009

If I enter into a textbox1 the following 09/31/2009 the result is that its not a date (because there is only 30 days in September - not 31). OR if I put in "13/25/2009"
Can I have a macro that checks whether or not its a valid date and if so a message box appears that says:
"Invalid date"

## Excel 2010 :: Using Current Month / Date And Time In A Folder Path In VBA Code

Feb 4, 2014

Iâ€™m working on a project using Microsoft Excel 2010 and I want to add some features to facilitate saving and retrieving files process.

1.How can I save the daily created workbooks (Assume 15 files a day) in order to contain the current date (and time if possible) linked with certain cell(s) I have at my workbook forming the file name? (XYZ 2-4-2014) and/or (ABC 2-4-2014 23:11) and so on â€¦

2.Iâ€™ve been through some other posts and I found VB code which saves the active file into specific path, but it is only useful for single workbook because multiple files are getting overwritten automatically. Is there a code which allows multiple/different files saving & creates daily folders?

## Value To Cell On CheckBox Check & Clear On Uncheck

Jan 6, 2008

I have created a checkbox which places a "TT" on a master sheet when checked on the NEW8 sheet. What I want to know is how do I get the "TT" to delete from the master sheet when unchecked on the NEW8 sheet. Below is what I have...

## Date/time Macro: Inserts The Current Date And Time In The Selected Cell Regardless Of Where That Cell Is

Oct 20, 2009

What is the code i need to use to assign a macro to a command button which inserts the current date and time in the selected cell regardless of where that cell is?

## VBA - Macro To Move Textbox Entry To Cell Based On Date

Dec 4, 2011

I have a row of dates in row 2 (all sequential, from Nov through to June next year)

I have a row of number entries in row 3 (to correspond with the date in row 2 it was entered on).

I want to be able to add a new entry (a number) into a text box, click a macro button, which makes the text box input be moved into the cell underneath todays date (so every day the cell will move one column along)

I've managed to make myself a textbox, and a macro button, but I'm stuck with how to make it all work.

## Highlight Cell If It Is The Current Month?

Jan 23, 2014

I have a calendar where the months are listed at the top of the columns and the day of the week is listed in the row. The months and dates are all formatted as a date (Jan is 1/1/2014).

______Jan___Feb___Mar...
...
Tue____7_____4_____4
Wed ___8_____5_____5
Thu____9_____6_____6

I just need to highlight the cell with the name of the month if it is the current month. I'd prefer to use conditional formatting.

## Can't Get Checkbox To Go True From Another Userform

Aug 14, 2009

I am trying to do is develop a electronic visitors log in excel that has three statements visitors must read and accept before they can enter. I have a userform with date/time, name etc, then the three buttons that open another user form with the statements for them to read and 2 command buttons (Accept and Decline), Accept takes them back to the log-in userform and Decline closes all forms.

The problem I am having is I can’t get the checkbox on the log-in form next to each statement to go true when the accept button is clicked for said statement. I would like to disable the checkbox on the visitorsignin form so the only way it goes true is from the statement form.

I hope I explained myself well enough for someone to understand what I’m trying to do, the code is not finished yet either, still waiting for signature pad to come in so I can paly with it and figure out how to incorporate it into the file.

## Formatting TextBox And Check Which TextBox Is The Active TextBox In The Loop

May 18, 2006

I am attempting to format some TextBoxes from within a For/Next loop. I need a way to check which TextBox is the active TextBox in the loop. Using i as the variable, I came up with this code snippet: Me.Controls("TB" & i).Text = Format("TB" & i, "mm/dd/yy")

If i = 3, this gives me in TextBox3 (which is called TB3) the text 'TB3' and not the value of what is in TB3. It has got to bo something simple, I just can't see it!!!