View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mslady[_10_] Mslady[_10_] is offline
external usenet poster
 
Posts: 1
Default How to fill value in cell based on date criteria?


Hi Cush, thanks for you prompt response:

but what i want is to check range of column A.
the date is in this format month-day-year i.e. *"3/12/05"* meanin
March 12, 2005.
No Column E will be any value.

If column A is January 2005 fill in 949007 in corresponding cells i
column E
If column A is February 2005 put 104332

I am only doing for these 2 months. And the values to be added ar
fixed. I just used 11111 and 22222 to give examples, it's no
continuous for all the months.

Thanks. :)

cush Wrote:
Without knowing how many rows you want to check, or whether the patter
in
Col E
will continue adding 111111 each time (which is assumed in th
following
code) you might try something like the following. Adjust as needed

Option Explicit

Sub CheckDate()
Dim i As Integer, j As Integer, k As Long

j = 1
k = 222222

For i = 1 To 2 'number of rows to check
If Cells(i, 1) = DateValue(j & "/1/2005") _
And Cells(i, 1) <= DateValue(j + 1 & "/1/2005") - 1 Then
Cells(i, 5) = k
Else
'do nothing or maybe something else
End If
j = j + 1
k = k + 111111

Next i

End Sub

"Mslady" wrote:


If value is column A is Jan-05, fill in value of 222,222 in matching
column E.
If value in column A is Feb-05, fill in value of 333,333 in matchng
column E.
Column A is in this format (3/12/05).

How do i achieve this with VBA?
Thanks in advance ;)


--
Mslady


------------------------------------------------------------------------
Mslady's Profile

http://www.excelforum.com/member.php...o&userid=27776
View this thread

http://www.excelforum.com/showthread...hreadid=480299



--
Mslad
-----------------------------------------------------------------------
Mslady's Profile: http://www.excelforum.com/member.php...fo&userid=2777
View this thread: http://www.excelforum.com/showthread.php?threadid=48029