Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Please help...formula problems

Thanks for the answer Bob but I still can't get it to work.
It's probably just me. I don't understand the code.
It's column H that we're putting initials of whoever enters the information
into the spreadsheet in and column I that we want the date to automatically
appear in.
We managed to get it to automatically put in a date, but everytime a new
cell in column H was filled the date went into the next cell in I but it
changed all the dates in that column to match.

I'm hoping that it is possible to sort this out and I REALLY appreciate your
help.

Thanks,
Nikki

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Offset(0, 1).Value = Date
.Offset(0, 1).NumberFormat = "dd mmm yyyy"
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"nikkiamii" wrote in message
...
I am trying to get excel to automatically insert a date in a cell when the
cell next to it is filled.

I've tried using the IF and NOW functions but I don't think I can use them
together.

Please help because I don't seem to be able to find an answer anywhere!




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help...formula problems

Have you tried a basic cell formula like this one?

=IF((cellreference)<"",NOW(),"")

That will return a date in the cell based on whatever cell you reference.
You just need to format the cell to a date format in the cell that you have
the formula.

"nikkiamii" wrote:

Thanks for the answer Bob but I still can't get it to work.
It's probably just me. I don't understand the code.
It's column H that we're putting initials of whoever enters the information
into the spreadsheet in and column I that we want the date to automatically
appear in.
We managed to get it to automatically put in a date, but everytime a new
cell in column H was filled the date went into the next cell in I but it
changed all the dates in that column to match.

I'm hoping that it is possible to sort this out and I REALLY appreciate your
help.

Thanks,
Nikki

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Offset(0, 1).Value = Date
.Offset(0, 1).NumberFormat = "dd mmm yyyy"
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"nikkiamii" wrote in message
...
I am trying to get excel to automatically insert a date in a cell when the
cell next to it is filled.

I've tried using the IF and NOW functions but I don't think I can use them
together.

Please help because I don't seem to be able to find an answer anywhere!




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Please help...formula problems

Yes we tried that but everytime a new cell in the column was filled all the
cells with the date or now formula in them changed to the current date and
time.

"Dave at TAX" wrote:

Have you tried a basic cell formula like this one?

=IF((cellreference)<"",NOW(),"")

That will return a date in the cell based on whatever cell you reference.
You just need to format the cell to a date format in the cell that you have
the formula.

"nikkiamii" wrote:

Thanks for the answer Bob but I still can't get it to work.
It's probably just me. I don't understand the code.
It's column H that we're putting initials of whoever enters the information
into the spreadsheet in and column I that we want the date to automatically
appear in.
We managed to get it to automatically put in a date, but everytime a new
cell in column H was filled the date went into the next cell in I but it
changed all the dates in that column to match.

I'm hoping that it is possible to sort this out and I REALLY appreciate your
help.

Thanks,
Nikki

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Offset(0, 1).Value = Date
.Offset(0, 1).NumberFormat = "dd mmm yyyy"
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"nikkiamii" wrote in message
...
I am trying to get excel to automatically insert a date in a cell when the
cell next to it is filled.

I've tried using the IF and NOW functions but I don't think I can use them
together.

Please help because I don't seem to be able to find an answer anywhere!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help...formula problems

Ok, then the VB code should work like this:

Private Sub Worksheet_Change(ByVal Target As range)
With Target
If Cells(.Column, 1).Value = "" Then
Cells(.Row, 2).Value = Date
End If
End With
End Sub

The .column, # and .row, # should be chaged to reflect which column # your
entry and result should go in (e.g., .column, 1 is column A, .row, 1 is also
column A). This should work.

"nikkiamii" wrote:

Yes we tried that but everytime a new cell in the column was filled all the
cells with the date or now formula in them changed to the current date and
time.

"Dave at TAX" wrote:

Have you tried a basic cell formula like this one?

=IF((cellreference)<"",NOW(),"")

That will return a date in the cell based on whatever cell you reference.
You just need to format the cell to a date format in the cell that you have
the formula.

"nikkiamii" wrote:

Thanks for the answer Bob but I still can't get it to work.
It's probably just me. I don't understand the code.
It's column H that we're putting initials of whoever enters the information
into the spreadsheet in and column I that we want the date to automatically
appear in.
We managed to get it to automatically put in a date, but everytime a new
cell in column H was filled the date went into the next cell in I but it
changed all the dates in that column to match.

I'm hoping that it is possible to sort this out and I REALLY appreciate your
help.

Thanks,
Nikki

"Bob Phillips" wrote:

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Offset(0, 1).Value = Date
.Offset(0, 1).NumberFormat = "dd mmm yyyy"
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"nikkiamii" wrote in message
...
I am trying to get excel to automatically insert a date in a cell when the
cell next to it is filled.

I've tried using the IF and NOW functions but I don't think I can use them
together.

Please help because I don't seem to be able to find an answer anywhere!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula Problems Ayo Excel Discussion (Misc queries) 2 February 10th 10 01:24 AM
aauugghhh...#div/o problems & various average formula problems acbel40 Excel Worksheet Functions 5 October 19th 09 05:00 PM
formula problems LoveExcelButFrustrated Excel Discussion (Misc queries) 4 June 11th 08 08:51 PM
Formula problems [email protected] Excel Programming 5 September 19th 06 01:36 PM
Formula problems!! ABEone Excel Programming 3 January 22nd 06 08:18 PM


All times are GMT +1. The time now is 09:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"