Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Update cell using vba

Using Excel 2003:

What I would like to do is type a number into a cell and then when I hit
enter I would like vba to update that number through a formula. I know I
could just add another column but if possible I would like to do it the way
mentioned.

Pete Provencher


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Update cell using vba

I'd use the other cell--just because it might make it easier to update the cell
when I make a typing change.

But if you want, rightclick on the worksheet tab that should behave this way.
Select View Code and paste this into the code window:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a:a")) Is Nothing Then Exit Sub

On Error GoTo ErrHandler:

If IsNumeric(Target.Value) = False Then
Exit Sub
End If

Application.EnableEvents = False
Target.Value = Target.Value * 2 + 3 + Target.Value ^ 4

ErrHandler:
Application.EnableEvents = True

End Sub

I check column A -- you may want to change this.

And I bet my formula isn't what you wanted.

Pete Provencher wrote:

Using Excel 2003:

What I would like to do is type a number into a cell and then when I hit
enter I would like vba to update that number through a formula. I know I
could just add another column but if possible I would like to do it the way
mentioned.

Pete Provencher


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Update cell using vba

Thanks. It worked for what I needed.

Pete Provencher
"Dave Peterson" wrote in message
...
I'd use the other cell--just because it might make it easier to update the
cell
when I make a typing change.

But if you want, rightclick on the worksheet tab that should behave this
way.
Select View Code and paste this into the code window:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a:a")) Is Nothing Then Exit Sub

On Error GoTo ErrHandler:

If IsNumeric(Target.Value) = False Then
Exit Sub
End If

Application.EnableEvents = False
Target.Value = Target.Value * 2 + 3 + Target.Value ^ 4

ErrHandler:
Application.EnableEvents = True

End Sub

I check column A -- you may want to change this.

And I bet my formula isn't what you wanted.

Pete Provencher wrote:

Using Excel 2003:

What I would like to do is type a number into a cell and then when I hit
enter I would like vba to update that number through a formula. I know I
could just add another column but if possible I would like to do it the
way
mentioned.

Pete Provencher


--

Dave Peterson



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
Data Validation lists update orginal cell with list update [email protected] Excel Worksheet Functions 3 July 11th 08 07:56 AM
Update Excel cell in formula not refreshing answer cell Johnny Excel Discussion (Misc queries) 2 June 21st 07 05:49 AM
auto-hide rows, cell format (# and @), update cell refs, shade cel Mo2 Excel Discussion (Misc queries) 0 April 17th 07 03:44 AM
Populating Last Saved Date in Cell AND also update that same cell in Header o0o_Bigs_o0o Excel Discussion (Misc queries) 2 July 4th 06 12:56 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM


All times are GMT +1. The time now is 07:49 PM.

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

About Us

"It's about Microsoft Excel"