How To Select Date Column
Aug 15, 2014
I am using EXCEL VBA and SQL statement to try to select some data in worksheet
Below is my worksheet sample
datee name product_name product_code
2014/6/1 Eric Toy_A C0001
2014/6/3 Stephen Toy_B C0003
2014/6/16 Calvin Toy_C C0003
2014/6/19 Perry Toy_D C0001
2014/6/23 Calvin Toy_E C0002
Here is my code segment for select data
strQuery = "SELECT * FROM[List$] where promoter_name = 'Calvin' and promoter_code = 'C0003'"
Set rs = cn.Execute(strQuery)
This is success to select data with no error
============================
But when I changed the condition to use datee column
strQuery = "SELECT * FROM[List$] where promoter_name = 'Calvin' and datee = '2014/6/23'"
It cannot work The error message said data type incorrect
Do I need to set any thing before run the sql?
View 5 Replies
ADVERTISEMENT
Jun 25, 2014
I need to create a data base from figures extract everyday. I would like according the date to copy the figures in the sheet "Extractor" to paste in the column corresponding to the day of today in the sheet "Database". If possible as well, the figures of the dates before today must be delete (in the color tab)
I join a sample of what I have. I tried with the indirect function, but didn't find how to keep the figures of the previous dates.
View 2 Replies
View Related
Nov 23, 2006
I have a history worksheet which itemises all stock movements and enters all the movements on the next empty row as they are processed.
The transaction date for each movement is recorded in column H.
How can I select all rows with the same date in column H bearing in mind that there will be different numbers of rows each day?
View 9 Replies
View Related
Apr 18, 2007
I am looking for a macro that will put data from another worksheet by the date. So if A1 is 01/01/2007 I want to bring the information in from A2,A3,A4 and so on in A1 on the other worksheet. But if B1 is 01/01/2007 I want to bring the information in for B2,B3,B4 and so on in A1 on the other worksheet.
View 4 Replies
View Related
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
View 7 Replies
View Related
Oct 28, 2006
i need VB to select the start date of booking and autohighlights the "blank booking slot cells" until the end date that is input in Excel. You can visualise this as a room booking system. The left most column is the dates and the first row represents the different rooms type. E.g. if one guest books the Twin Deluxe No. 123 room on 23 Oct 2006 until 25 Oct 2006. We wish the VB can essentially help us identify the start date then begins highlighting the three slots for 23, 24 and 25 Oct on the column for the Twin Deluxe Room 123.
View 4 Replies
View Related
Oct 28, 2006
We are doing a project on a booking system and wish to use VB codes to autohighlight the slots from the start date until the end date.
View 9 Replies
View Related
May 28, 2014
I'm trying to write a simple VBA code to loop through values in the range A14:A138 and based on the value (of a possible four values) in any row of that range, populate the adjacent column in the same row with a conditional result. For example if A14 = "Cat", then B14 = "I"; if instead A14 = "Dog", B14 = "II", etc. If there is no value in column A, the result should be blank (i.e. "").
I believe are in coding the destination range since I can get it to work for just one cell in B! Below is my code that is not working...
[Code].....
View 7 Replies
View Related
Mar 18, 2014
I have 02 separate excel workbooks
01 = source file
02 = data list
The workbook "source file" contains all the data
The workbook "data list" contains data for work with Drop-down list. And i can easily select my required description by just dropping down the list.
In case, i have new description i add it in the source file and it is updated in the working "data list" sheet.
This applies to Field device column also. But i want to improve the selection criteria by creating such script or formula which could check the input of the description and automatically selects the field device and its relevant signal (output type).
Screen shot is attached : Automatic Selection.jpg
View 1 Replies
View Related
Mar 25, 2013
I am trying to find a macro that look for last non empty cell in column A and them paste a formula/comment in all cells of column B.
View 3 Replies
View Related
Jul 24, 2014
I know that this could be a stupid question, but was wondering if it could be possible. I would like to select a column by a keyboard shortcut. If I would press a key combination adding the letter of a column as example F, it would select the whole column. I was trying to search for this in google, but no luck.
View 10 Replies
View Related
Jan 30, 2012
I'm trying to make the below two column selections into a selected range to clear out formulas/values in the range.
Current code segments:
ActiveCell.EntireColumn.Select
Columns(ActiveSheet.UsedRange.Columns(ActiveSheet.UsedRange.Columns.Count).Column).EntireColumn.Select
Is there a way to combine the two code segments into one selected range?
View 6 Replies
View Related
May 27, 2014
In the attachment is a file, which allows me to specific a Column and hide. For Example enter "H" in the InputBox and Submit the Column "H" is hide.
What do i have to change in the code if i want to hide the "H" and the Column two columns next to "H". In this case "J".
HideColumn.xlsm
View 3 Replies
View Related
Feb 11, 2013
I have a sheet that begining in A3 and going down need to look for the First Instance of the text String "Loan Documents" and down to the last instance and select the corresponding range in column B.
Example: if the Text String appears in Range(A14:A32) I need the Range(B14:B32) to be my selected range.
View 1 Replies
View Related
Jan 30, 2014
was given only looked at the nearest date and not the nearest date after.
So here goes; I have a table that looks at new starters and the date they started, and then a list of dates appointments offered (these dates can and often do precede to person joining us).
What I'm looking for the first chronological date AFTER the New start Date.
In row 3 this works; as it is the nearest date, but in row 4 however, it is the nearest date; but occurs before the New start Date, thus is incorrect.
View 2 Replies
View Related
May 4, 2009
I have my data arranged in 4 columns as shown below (sample data). I need the Excel to find the largest value for each date and write them somewhere along with those dates. For example, the Excel should write in the 5th column (E) below two dates and values based on the sample data I listed below -
4/1/2007 - 0.044
4/2/2007 - 0.055
I have about 17-18 values for each date between 4/1/2007 and 10/31/2007.
Sample Data
========================================
A B C D
--------- ---------- ---- -----
Date SITE POCConcentration
4/1/2007 11001002510.039
4/1/2007 11001004110.042
4/1/2007 11001004310.039
4/1/2007 24009001110.042
4/1/2007 24017001010.044
4/2/2007 11001002510.051
4/2/2007 11001004110.048
4/2/2007 11001004310.052
4/2/2007 24009001110.053
4/2/2007 24017001010.055
4/2/2007 24021003710.055
View 7 Replies
View Related
Mar 14, 2007
I have a column with various dates (dd/mm/yyy, UK Format). What I want to do is select all cells in that columns where date =NOW().
View 9 Replies
View Related
Mar 14, 2008
a formula to pick a first and last date from two lists of dates.
I have attached a spreadsheet to show the exact problem.
View 14 Replies
View Related
Apr 4, 2013
I have a cell pulling the date from another page and the dates comes across as "2/1/2013- 4/15/2013"in cell B2 and I have the code in sheet 1[code]=IF(OR(Safeway!A43=""),"",Safeway!A43)[code] pulling data from the sheet 2 already in the middle with a code for later use to hide a certain character. I have a condition code set so if the date is past current date, it will turn red but with the 2 dates in the same cell, I am unable to get it to turn red. How do I go about only having the 2nd date show up so the condition works while already having this one code in the cell? I attempted to add the early stages of this program for review.
View 5 Replies
View Related
Jul 21, 2014
I am attempting to select a row if the date field value is within a date range.
I would like to be able to click a button, have a pop-up, be asked to insert a start date and an end date. For example 2014-07-01 and 2014-07-21 I would then like the macro to copy rows if the date value is within that range to the next available row onto a new worksheet.
View 1 Replies
View Related
Jan 18, 2013
Basically I got to create a spreadsheet which needs to last 10 years......my workbook, has set up tab, a tab for each month, and a summary sheet.
At the start the end user needs to select a year in cell 'Set-Up & Info'!B8 (i use a dropdown box, so they can select the year)
I then want my April tab to think 01/04/ then the year which is in cell 'Set-Up & Info'!B8
I then custom format the cell below to show what the day is (Custom format "DDD"), so it the row below needs to be in a date format.
View 2 Replies
View Related
Mar 13, 2008
I need to let my users select their own start date for project work. All details so far are entered using a form. What methods are there?
View 9 Replies
View Related
Dec 23, 2008
It sits in the "This Workbook" code window to run each time the wbook is opened. What I want it to do, is based on the date in Sheets("Control").Range("L3") select a particular cell in another sheet called "Risk Sum". I'm assuming this is easy to do, I've come up with the following, but it just doesnt want to work ...
View 9 Replies
View Related
Jul 24, 2007
I'm trying to write a code to define different months and shade their backgrounds but i can't seem to get it to work.
The fields are set out as follows:
01/01/2007 13:31
The code i have at current is:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer
If Not Intersect(Target, Range("A1:Z1000")) Is Nothing Then
Select Case Target
Case 1 / 1 / 2007 To 31 / 1 / 2007
icolor = 6
Case 1 / 2 / 2007 To 31 / 2 / 2007
icolor = 7
Case 1 / 3 / 2007 To 31 / 3 / 2007
icolor = 8
View 9 Replies
View Related
May 14, 2014
We have a table that tracks customer payment dates with corresponding payment details.
Our current Excel program works fine when the Customer payment dates progress (non-duplicate date entries) ... BUT .... sometimes a Customer will send multiple checks on the same date (duplicated date entries), and then our program gives incorrect results.
You will see that this Customer sent in three checks all dated 11/22/2013 ($100, $50, $50).
What we need is a formula that will look at the dates in Column-A, choose the last entry (before any zero or blank), then provide the corresponding value in Column-D.
So in this case, the result we need is (100.00) ... the value in cell D16. Our program is erroneously providing 100.00 ... the value in D14.
View 3 Replies
View Related
Jan 20, 2010
I'd like to select the start date & end date for multiple Pivots (on one sheet).
Expl. if I put in a date in the "Start Date" cell : 01/01/2010 and another date in the "End Date" cell : 15/01/2010. Then all the pivots on the sheet should only show the date between 01/01 and 15/01/2010.
The dates in the pivots are under column "Date".
I have a code but it only selects 1 pivot and it doesn't refresh the pivots when you change the dates selection.
View 2 Replies
View Related
Jun 17, 2013
I formatted a cell as a date but somehow people still manage to mess it up.
Is there a pop-up calendar that appears when the user clicks on a cell?
View 2 Replies
View Related
Sep 27, 2009
I want to make an easy to use timesheet for work. I have a calendar set up on a sheet in a workbook and i want to be able to select any date in this calendar and have it be copied into a cell of my choosing in another worksheet in the same book. I already have the formula set up to auto fill the rest of the week from that date, any ideas how to do the selection and copy and paste part quickly and simply?
I am using a mac so cant use the calendar control function as far as I know, if I'm wrong let me know because it sounds very simple.
I have tried to adapt some code and it all works (I get no error messages) but for the fact that nothing is pasted. What is wrong and is there an easier way?
Sub AddDate()
Dim dt As Range
Dim wc As Range
On Error Resume Next
Set dt = Application.InputBox("Select the date", Type:=8)
Set wc = Application.InputBox("Click on week commencing", Type:=8)
If dt Is Nothing Or wc Is Nothing Then Exit Sub
Range("dt").Select
Selection.Copy
Range("wc").Select
ActiveSheet.Paste
On Error GoTo 0
End Sub
View 9 Replies
View Related
May 9, 2007
I have a workbook that is connected to a MySQL DB.
I want to get all the months organised in columns then the Amounts of those months underneath the specific month. I can only do one at the moment in this select query but do not know how to go forward by creating the other month and their data?
My code looks like this:
Private Sub cmdGO_Click()
Dim conn As ADODB.Connection
Dim dbRecset As ADODB.Recordset
Dim sSQL As String
Dim l As Long, l2 As Long
Dim Last_Row As Long
View 7 Replies
View Related
Nov 21, 2012
I am thinking of commanding macro to select worksheet tab based on the system date to do some pasting.
My worksheet tab is as follow:
Nov-12, Dec-12, Jan-13, Feb-13 and .........
What should be the macro script required to select the worksheet tab based on today's date?
View 2 Replies
View Related