VBA Code For Entering Dates

Jun 13, 2013

I need a VBA code for entering dates. The start date cell is A15.When I select cell A15 and hit macro button it inserts todays date and fills in 1-month of dates in column A excluding the weekends...

View 3 Replies


ADVERTISEMENT

Entering Dates In Sequential Order

Jun 16, 2012

I'm trying to enter dates in order in excel 2010. But alot faster than manually entering each date. I've tried the date funtions only to be met with errors.

6/9
6/10
6/11
6/12
etc.

where each date is in a new cell.

View 3 Replies View Related

Activating VBA Code When Entering A Cell?

May 9, 2014

I am trying to write a small bit of VBA code, so that I can record the row and column of the active cell. I have got it working when I CHANGE the value of the cell, but I need to get the code to fire off when I ENTER the cell.

The code section is below:-

Private Sub Worksheet_Change(ByVal target As Range)
'Store the row and column into G1 and G2 for the drop down loading
Call RowNum(target)
End Sub

[Code]....

how I can do this, as I cannot find reference to a Worksheet_Enter function ?

View 2 Replies View Related

VBA Code To Lock Cell After Entering Data

Feb 2, 2014

I have a worksheet, i want to lock the data entered in a cell of a particular column . e.g. if i will enter the data in A2, A2 should be locked, when user enter data in cell A3, A3 should be locked. I want this code to apply on multiple columns (A,C,E,G).

View 3 Replies View Related

Lock Cells Automatically After Entering Via Macro Code

Apr 23, 2008

I have an excel sheet which has a macro which captures the current time in a cell with the formula =now(). What I am looking for is that once a user runs a macro and the time is inserted into that cell then that cell should be locked and cannot be changed then. If this can be done by any formula / function or VBA.

View 2 Replies View Related

Formula Entering Zip Code And Returning Tax Rate From Established List

Oct 29, 2013

I am trying to create a formula that will allow me to enter a zip code and have excel return the specific tax rate for that zip code. I have zip codes in excel for all of California along with the corresponding tax rates. I am creating a form that I can just input the zip code and have the tax rate automatically pop in.

View 1 Replies View Related

First Code In VBA: Use A Inputbox For Entering The First Date For Monday Of The Month Each Time I Use The Worksheet

Jun 23, 2006

I am writing a module which have a different test based on for each of the previous 2 column cells. It calculate the days passed or in simple way calculate the date difference for the 2 columns and puts them in third. But i need to use a inputbox for entering the first date for monday of the month each time i use the worksheet.
When i try using the module for each cell of the column it display the input box for each cell. is there any way so that i just enter the value in input box and it can be used in rest of the module.Without using it again and again.

View 8 Replies View Related

Automatically Get All The Dates Of A Month Entering Specific Year And Month

Dec 1, 2012

In a sheet I enter the following:

... in A1 a year (say 2012)
... in A2 a month, formatting as "MMM" (JAN, FEB, MAR etc.)

How to automatically get in column A (say from A3) all the dates of the month entered, formatting as "D/M/YYYY" (e.g. 1/1/2012, 2/1/2012/ 3/1/2012, etc.)?

View 3 Replies View Related

VB Code For Looking Between Two Dates For Certain Criteria

Jul 2, 2014

On worksheet A I have a series of dates and a location:

Date Location
05/07/2014 Zoo
09/07/2014 Farm
12/07/2014 Cinema

This is a series of trips that are planned to occur. In order to occur there is a criteria which is recorded seperately and is coded as '1' = criteria were broken and '2' = criteria were not broken. The criteria for each trip must be met from the date of the last trip until the day before the next trip - so using the above example, to get the farm, the criteria must be met from 05/07/2014 until 08/07/2014. In practical terms, there must be no '1' in the desingated column that records the criteria - fairly simple.

But there is an allowance of one case of the criteria being broken, which is recorded seperately ('1' = allowance used and '2' allowance not used). This allowance resets after every potential trip (whether the trip was earned or not). This is all displayed as a 'status' on Worksheet B.

So in terms of practical VB code I'm looking for:

-Start with row A on worksheet A - copy the date and location onto worksheet B (the next trip)
-On opening the file, take the date of the last trip (or in the case of the first trip, the designated start date)
-Look into Column J (between date of last trip and date of next trip) to see if allowance has been used (a '1')
-Look into column K (between the two dates) to see if the criteria has been broken on more than one ocasison (two '1')
-OR if possible - compare column J and K (between the two dates) to see if a criteria was broken AFTER the allowance has been used

Then, look to see if today's date is the same date as the next trip, if it is, move the reference down to the next rown (A3, A4, etc) on Worksheet A so that the status now reflects the next trip, and the code now looks between the two new dates.

How to do most of it, but its the comparing between two dates and the different criteria that is stumping me.

View 8 Replies View Related

VBA Code To Convert Dates

Feb 15, 2010

I received a solution to a question recently whereby I was instructed to use the text-to columns function to solve a problem I was having with a column of dates.

Convert Dates To Another Format

The solution provided was;
Select Data > Text to Columns > Next > Next > Column Data Format > Date.

The solution works fine when performed manually but if you perform this function while recording a macro, the crucial piece that changes the date output is not captured by the recorder so when you run the macro nothing happens.

To expand on how I recorded it, after starting the text to column dialogue and pressing Next twice, the dialog provides me with a drop down selector where I am able to change the date format from the default DMY to the desired MDY which - when selected manually - fixes my problem. However, when I record a macro while performing this action the date format choice I made is not being recorded in the macro output so when I try running the macro later on the original data, nothing happens.

The recorded macro ends up looking like this; ....

View 9 Replies View Related

AutoFilter Code Between 2 Dates

Nov 24, 2007

I am encounting problems with an AutoFilter which is run in a macro after the user has selected dates from 2 Date Pickers (DTPicker) on a user form. The filter is applied to 1 column in a spreadsheet containing dates in the formay "dd/mm/yy" and is supposed to filter dates =2 and between a range of dates as selected. The resultant filter is blank, if the macro is debugged at this point the date format for the 1st criteria is found to have swopped the "dd" & "mm" around but the 2nd criteria is fine. eg. user selected 01/07/07 and 31/07/07 the resultant filter applied is 07/01/07 and 31/07/07. I have re-formatted dates to Long as per the article on this site @ http://www.ozgrid.com/VBA/autofilter-vba-dates.htm but still get the same result ???

Dim fDate, tDate As Date
Dim lfDate, ltDate As Long
fDate = frmReportMenu.dtpFromDate.Value
tDate = frmReportMenu.dtpToDate.Value
fDate = DateSerial(Year(fDate), Month(fDate), Day(fDate))
tDate = DateSerial(Year(tDate), Month(tDate), Day(tDate))
lfDate = fDate
ltDate = tDate

View 2 Replies View Related

Compare 2 Dates In VBA Code

Feb 15, 2008

I am getting a type mismatch error ehen comparing 2 dates. I tried entering all date formatting but it still throws the same error... here is my code. i have highlighted in bold where I get the error. the Error it throws is Run Time Error 13. Type Mismatch Error. I am using office excel 2003 SP3

Dim siebApp As SiebelWebApplication
Dim siebBusObj As SiebelBusObject
Dim revBC As SiebelBusComp
Dim isRecord As Boolean
Dim sRep As String
Dim sCompany As String
Dim sLocation As String
Dim sStep As String
Dim sProb As String
Dim sDate As String
Dim RetDate As Date
Dim CurDate As Date
Const DateCol = 9
CurDate = Now()
RetDate = Sheets("Users"). Cells(DateCol)
r = Sheets("Users").Cells(65536, 1).End(xlUp).Row 'Get next blank row
Sheets("Users").Cells(r, DateCol) = CurDate
'Create The Siebel WebApplication Object
Set siebWebApp = CreateObject("TWSiebel.SiebelWebApplication.1")...........................

View 5 Replies View Related

VBA Code For Multiple Expiration Dates

Jun 11, 2014

I have a vba code for an excel spreadsheet that lets me know when a particular persons' certification is about to expire (within 31 days). However what I cannot figure out is how to make this work with more than one expiration date ( additional columns containing other certification dates). I keep getting errors when trying to add additional columns to check ( I do admit that my VBA coding is atrocious at best).

Ultimately what I would like to achieve is a list of names with expiration dates alongside popping up when opening, but maybe I am asking too much?

View 9 Replies View Related

Creating VBA Code To Filter By Dates

Jun 3, 2012

I have a macro I am using that uses several date filters. There are filters for the previous month, previous 6 months, previous year, all dates in the future, etc.

Every month I have to edit the macro and change the dates in the macro so it remains accurate. Is there any way I can modify the macro so that the dates are stored in a cell within the workbook and not in the macro?

What I would like is to type the date ranges in a sheet within the workbook and have the macro look to those cells for the date filter instead of typing in exact date ranges within the macro. This way the actual macro code does not need to be modified every month. I would like to only have to change cells within the worksheet and not touch the macro code.

View 4 Replies View Related

Filter Macro Code For Dates

Apr 30, 2008

I have a set of data that I need to sort and filter and create pivot tables with 2-3 times per week. Example data sheet attached (confidential data removed). I will insert the code that I am using for reference. The issue is that when the data is filtered for 'Approved Timesheets' I need the filter to be based on 2 criteria; If myBaseRow.Cells.Item(1, 21) <> "Approved" Then If myBaseRow.Cells.Item(1, 44) <=StartDate And myBaseRow.Cells.Item(1, 44) >=EndDate Then

The first If statement works fine, but the second appears to be ignored?? I have tried to colour this part of the code blue to make it easily visible.

Private Function PTSubtotals(ByRef PTField As PivotField)

PTField.Subtotals = _
Array(False, False, False, False, False, False, False, False, False, False, False, False)
End Function
Sub Timesheets()
'
' Timesheets Macro
' Timesheet Filter 4/22/2008 by Richard Francis
'
Dim myWorkBook As Workbook
Dim myBaseWorkSheet As Worksheet
Dim myBaseRange As Range
Dim myBaseRow As Range
Dim RowsCounter As Long
Dim StartDate As Date
Dim EndDate As Date
StartDate = Format(Date, "mm/dd/yyyy")
EndDate = Format(Date, "mm/dd/yyyy")

On Error Resume Next
StartDate = Application.InputBox("Enter start date", Type:=2)
On Error Goto 0
If StartDate > 0 Then.................................

View 3 Replies View Related

Macro Code With VLOOKUP On Dates

Jun 18, 2008

I'm trying to look up a value in Analytics Data searchin for the date in B9 to B & rader.

I get error messages, because i can't find the dates. But I'm sure I have defined the ranges correct. The code works in another workbook with the difference that the table with the variables I'm trying to lookup are in the same sheet as the where I want to place them.


Private Sub Upd1_Click()
Dim rader As Double

Dim lookrng As range
Dim updvalue0 As Double
Dim updvalue1 As Double
Dim updvalue2 As Double
Dim updvalue3 As Double
Dim updvalue4 As Double
Dim updvalue5 As Double .........

View 9 Replies View Related

VB Code To Remove 00/01/1900 Dates From Spreadsheet

Feb 6, 2014

I have a spreadsheet which was formatted from VB code. Within the sheet there are four date columns where some dates show as 00/01/1900 (due to them having '0' in at the time of running the code). I am trying to run some code to blank out all cells showing the 00/01/1900 date, but the code just isn't touching it. I reverted to simply recording the 'find and replace' function and inserting into my code, but those irritating dates still remain.

Code I have used is as follows:

[Code] .....

View 4 Replies View Related

VBA Code To Filter On Specific Two Dates (Pivot Table)

Jun 20, 2014

I am trying to Auto filter on a pivot table "dates" via VBA coding.

Where:
Startdaycomp = 11-May
Finishdaycomp = 18-May

Rather then this showing all values between these dates, I was hoping to see only those two dates. This will enable my to compare weekdays for a Dashboard.

Is this possible?

View 7 Replies View Related

Excel 2010 :: Code For Inserting And Removing Dates

Dec 14, 2012

I need a code that when i place a date in a cell D10 (Example:25-January-2013) it will then add 40 days of dates daily to AP10.In D9 can it also add the weeknumber (every 7 days the weeknumber increases by 1) corresponding to the day date in D10 (iso).Can this be attached to a button.Enter the date in D10 then press the button and the dates auto insert across the sheet daily to AP10.

Can the button say ADD DATE or REMOVE DATES.First date in D10.When the button says REMOVE dates all dates deleted when button pressed and cell D10 then says "add date here".If no date is placed in D10 and ADD DATE button is pressed a warning messagebox appears and says NEED TO ADD DATE .Will not work until date entered.When date entered in D10 "Add Date Here" disappears until REMOVE Date button is selected and again "Add Date Here" is displayed....not sure if this is possible but would be good if achieved. Excel 2010

View 3 Replies View Related

Macro Code To Get Saturday And Sunday Dates On Inputting Year

Jan 16, 2014

I am looking for Macro code preferably to get list of dates with Saturday / Sunday in a separate columns which falls Saturday and Sunday on imputing the year.

View 5 Replies View Related

Hard Sorting Process / Dates And Supplier Code Mixed In Same Column?

Jan 22, 2013

I have an auto generated report that is exported into .csv, my dilemma is that it sorts both the account code and the date in the same column, like this:

9884A B Gerrish Ltd œ 577.270577.270
30/09/201231/10/20121865518655277.010277.01MAL/553260
30/09/201231/10/20121884218842264.260264.26MAL/553259
30/11/201231/12/2012195541955436036MEL/549200

so "9884" and "30/09/2012" are in the same column.

Some how i need to turn this information to say the below three invoices are for account 9884, into more of a usuable data like:

9884 A B Gerrish Ltd 30/09/2012 etc etc.

Obviously through out the document this repeats for each account, upto some 1000 accounts.

jas.xlsx‎

View 11 Replies View Related

VBA Code Line That Allows To Disregard Dates That Have Passed In Current Emailing Macro?

Apr 11, 2014

The code as it stands allows me to push a button and it immediately picks up on a meeting category and date of meeting, then sends emails to those that are supposed to attend based on a date that is within 7 days from the current date of pressing that button. HOWEVER; it seems to still send the email when the date has passed...is there a line I can put in this code to make it so that every date that has already passed will be discounted from future emails?

The code is as follows:

[Code].....

View 1 Replies View Related

Zero Value Even Without Entering 0

Feb 21, 2007

I need a cell to read $0.00 always even if the cell is deleted. so if blank = $0.00.
Here is what I thought would work but doesn't.

Sub Worksheet_Change(ByVal Target As Range)
Range("b5").Value = 0
End Sub

View 9 Replies View Related

Entering =NA()

Oct 1, 2008

Has anyone come accross any smart and time saving alternatives to enter =NA() in any empty cells.

View 9 Replies View Related

Re-entering Cell Value

Dec 7, 2009

In some of my formulas, I need to re-enter the contents of the cell in order for a formula to compute.

For example, I am doing some math on a cell whose original contents are "10:21:00 AM" The formula returns a #NUM!. If I retype 10:21 in the cell and hit enter, the formula will now calculate properly. I have reformatted the entire column several times so that it is a custom hh:mm format. The original content also shows as time so I don't think that it is a formatting issue.

My worksheet has about 20,000 rows and this only happens for about 100 of the rows. It is pretty time consuming to manually go fix each one. Any ideas what is going on here?

View 6 Replies View Related

Entering Value When 2 Criteria Are Met?

Sep 12, 2013

I'm trying to get a formula that will enter a particular value when 2 specific criteria are met. I've been trying to use an =IF(AND( statement, but so far I keep getting a "the formula you typed contains an error" message.

I need to have cell V9 return a value of 8 if the following conditions are met:
Cell D9 = "SG"
Cell H8 of a different workbook (Called Work Schedule) = 3

I would like the value of V9 to change to 12 if:
Cell D9 = "SG"
Cell H8 of 'Work Schedule' = 19

My formula now looks like this:
=IF(AND(D9="SG",'WORK SCHEDULE'!H8=3,8,IF(AND(D9="SG",'WORK SCHEDULE'!H8=19,12,""))))

View 6 Replies View Related

Entering A Time

Dec 18, 2008

If I use format cells and choose time... do I have to enter the time in decimals to get it to show up like 1:30 PM? Or is there a way for me to type something quicker like 130 p?

View 9 Replies View Related

Entering A Barcode Without Getting +12 Formatted In

Mar 2, 2009

I'm trying to copy about 10,000 barcode over to a new spreadsheet, the prob is that when I copy them over they appear as XXXX+12 and then when I try and use them it doesn't like it. I can solve it if I format the column to text - and then double click it. This is ok for a hundred or so but fingers start to hurt after that!

View 14 Replies View Related

Entering A Payment And Seeing A New Balance

Apr 9, 2009

I would like to be able to choose a month (from a drop down menu), then choose who the payment will go to ie. creditor (from a drop down menu) ie. car, truck, cc payment, as a result of those selections, then enter the amount of the payment, and finally the ending balance will appear. I have the drop down menus in place and I have all the balance calculations in place. I could use the spreadsheet that I have but I only want to see the below info. Plus I don't know how to link or lookup this data to the stuff I've already created.

Select Month:
Select Creditor:
Enter Payment:
New Balance:

I have already set the sheet up calculating the balances after a payment has been made. I know how to hide all the formulas, but I don't know how to get it to so that you choose a month, then creditor type (from drop down menus), and payment so that you see a new balance. I only want to be able to link or lookup the month, creditor together so that a payment can be made to that cell that I've already established. As a result, then that cell can be shown in the new balance.

View 14 Replies View Related

Entering Text Automatically

May 4, 2009

I really DO have a problem. I need excel to create me a list of whenever someone enters their name. Now, this may sound simple, but, the text in the list CANNOT be allowed to be overwritten.Also the text needs to be entered into the NEXT empty cell between C30 and C50. This is basically so I can keep a record of whenever anybody does anything/modifies the cells that include text between S7 andS21

So basically if text is ever entered into S7 all the way down to S21, I need an automatic copy created into the next available cell between C30 and 390. It is also ok if there are duplicates values(names).

I would give a print screen, but I don't know where the attach button is on this forum.

View 11 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved