PC Review


Reply
Thread Tools Rate Thread

additon of cel imput automaticaly

 
 
Mario
Guest
Posts: n/a
 
      9th Nov 2003
hi
i have the following problem but no solution,

i want to format the cells B2:R99 as follow
for example B4 (like all others) if u enter a number it should add it
automatically for example:

Step1: input in B4 of 4 - output: 4 - algorithmus in formulr bar:
4
Step1: input in B4 of 5 - output: 9 - algorithmus in formulr bar:
=4+5
Step1: input in B4 of 3 - output 12 -algorithmus in formulr bar =
4+5+3
Step1: input in B4 of -4 output 8 - algorithmus in formulr bar
=4+5+3-4


i want to create a material list for a project for others, but this list
contains of 500 positions and 5 tables
but i want these data to be pursue-able . i am not really good in makro
programming, i have an additions algorithmus makro witch adds but it does
not give the algorithmus in the formular bar just the vallue of the output,
(for example only vallue 9 instead of '=4+5+7-7')

hope someone could help me

kind regards

mario


 
Reply With Quote
 
 
 
 
J.E. McGimpsey
Guest
Posts: n/a
 
      9th Nov 2003
one way:

Put this in the worksheet code module (right-click on the worksheet
tab, choose View Code, paste the code in the window that opens,
then click the XL icon on the toolbar to return to XL):


Option Explicit
Dim gvOldFormula As Variant

Private Sub Worksheet_Activate()
Dim i As Long
Dim j As Integer
With Range("B2:R99")
ReDim gvOldFormula(1 To .Rows.Count, 1 To .Columns.Count)
For i = 1 To UBound(gvOldFormula, 1)
For j = 1 To UBound(gvOldFormula, 2)
If .Cells(i, j).HasFormula Then
gvOldFormula(i, j) = .Formula
Else
gvOldFormula(i, j) = "="
End If
Next j
Next i
End With
End Sub

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count > 1 Then Exit Sub
If Not Intersect(.Cells, Range("B2:R99")) Is Nothing Then
If IsNumeric(.Value) Then
Application.EnableEvents = False
.Value = gvOldFormula(.Row - 1, .Column - 1) & _
"+" & .Value
Application.EnableEvents = True
gvOldFormula(.Row - 1, .Column - 1) = .Formula
End If
End If
End With
End Sub


In article
<3fae2f80$0$23152$(E-Mail Removed)>,
"Mario" <(E-Mail Removed)> wrote:

> hi
> i have the following problem but no solution,
>
> i want to format the cells B2:R99 as follow
> for example B4 (like all others) if u enter a number it should add it
> automatically for example:
>
> Step1: input in B4 of 4 - output: 4 - algorithmus in formulr bar:
> 4
> Step1: input in B4 of 5 - output: 9 - algorithmus in formulr bar:
> =4+5
> Step1: input in B4 of 3 - output 12 -algorithmus in formulr bar =
> 4+5+3
> Step1: input in B4 of -4 output 8 - algorithmus in formulr bar
> =4+5+3-4
>
>
> i want to create a material list for a project for others, but this list
> contains of 500 positions and 5 tables
> but i want these data to be pursue-able . i am not really good in makro
> programming, i have an additions algorithmus makro witch adds but it does
> not give the algorithmus in the formular bar just the vallue of the output,
> (for example only vallue 9 instead of '=4+5+7-7')
>
> hope someone could help me
>
> kind regards
>
> mario
>
>

 
Reply With Quote
 
Mario
Guest
Posts: n/a
 
      9th Nov 2003
hi

sry i got an error here

..Value = gvOldFormula(.Row - 1, .Column - 1) & _
"+" & .Value

any tips??


"J.E. McGimpsey" <(E-Mail Removed)> schrieb im Newsbeitrag
news:jemcgimpsey-(E-Mail Removed)...
> one way:
>
> Put this in the worksheet code module (right-click on the worksheet
> tab, choose View Code, paste the code in the window that opens,
> then click the XL icon on the toolbar to return to XL):
>
>
> Option Explicit
> Dim gvOldFormula As Variant
>
> Private Sub Worksheet_Activate()
> Dim i As Long
> Dim j As Integer
> With Range("B2:R99")
> ReDim gvOldFormula(1 To .Rows.Count, 1 To .Columns.Count)
> For i = 1 To UBound(gvOldFormula, 1)
> For j = 1 To UBound(gvOldFormula, 2)
> If .Cells(i, j).HasFormula Then
> gvOldFormula(i, j) = .Formula
> Else
> gvOldFormula(i, j) = "="
> End If
> Next j
> Next i
> End With
> End Sub
>
> Private Sub Worksheet_Change(ByVal Target As Excel.Range)
> With Target
> If .Count > 1 Then Exit Sub
> If Not Intersect(.Cells, Range("B2:R99")) Is Nothing Then
> If IsNumeric(.Value) Then
> Application.EnableEvents = False
> .Value = gvOldFormula(.Row - 1, .Column - 1) & _
> "+" & .Value
> Application.EnableEvents = True
> gvOldFormula(.Row - 1, .Column - 1) = .Formula
> End If
> End If
> End With
> End Sub
>
>
> In article
> <3fae2f80$0$23152$(E-Mail Removed)>,
> "Mario" <(E-Mail Removed)> wrote:
>
> > hi
> > i have the following problem but no solution,
> >
> > i want to format the cells B2:R99 as follow
> > for example B4 (like all others) if u enter a number it should add it
> > automatically for example:
> >
> > Step1: input in B4 of 4 - output: 4 - algorithmus in formulr

bar:
> > 4
> > Step1: input in B4 of 5 - output: 9 - algorithmus in formulr

bar:
> > =4+5
> > Step1: input in B4 of 3 - output 12 -algorithmus in formulr bar

=
> > 4+5+3
> > Step1: input in B4 of -4 output 8 - algorithmus in formulr

bar
> > =4+5+3-4
> >
> >
> > i want to create a material list for a project for others, but this list
> > contains of 500 positions and 5 tables
> > but i want these data to be pursue-able . i am not really good in makro
> > programming, i have an additions algorithmus makro witch adds but it

does
> > not give the algorithmus in the formular bar just the vallue of the

output,
> > (for example only vallue 9 instead of '=4+5+7-7')
> >
> > hope someone could help me
> >
> > kind regards
> >
> > mario
> >
> >



 
Reply With Quote
 
Tom Ogilvy
Guest
Posts: n/a
 
      9th Nov 2003
Try replacing the first routine with the below, then
Select a different sheet, then come back to this sheet and try again.

Private Sub Worksheet_Activate()
Dim i As Long
Dim j As Integer
With Range("B2:R99")
ReDim gvOldFormula(1 To .Rows.Count, 1 To .Columns.Count)
For i = 1 To UBound(gvOldFormula, 1)
For j = 1 To UBound(gvOldFormula, 2)
If .Cells(i, j).HasFormula Then
' gvOldFormula(i, j) = .Formula
gvOldFormula(i, j) = .Cells(i, j).Formula
Else
'gvOldFormula(i, j) = "="
gvOldFormula(i, j) = "=" & Trim(.Cells(i, j).Value)
End If
Next j
Next i
End With
End Sub

or

Private Sub Worksheet_Activate()
Dim i As Long
Dim j As Integer
With Range("B2:R99")
ReDim gvOldFormula(1 To .Rows.Count, 1 To .Columns.Count)
For i = 1 To UBound(gvOldFormula, 1)
For j = 1 To UBound(gvOldFormula, 2)
With .Cells(i,j)
If .HasFormula Then
gvOldFormula(i, j) = .Formula
Else
'gvOldFormula(i, j) = "="
gvOldFormula(i,j) = "=" & trim(.value)
End If
End With
Next j
Next i
End With
End Sub


--
Regards,
Tom Ogilvy

Mario <(E-Mail Removed)> wrote in message
news:3fae7c08$0$33274$(E-Mail Removed)...
> hi
>
> sry i got an error here
>
> .Value = gvOldFormula(.Row - 1, .Column - 1) & _
> "+" & .Value
>
> any tips??
>
>
> "J.E. McGimpsey" <(E-Mail Removed)> schrieb im Newsbeitrag
> news:jemcgimpsey-(E-Mail Removed)...
> > one way:
> >
> > Put this in the worksheet code module (right-click on the worksheet
> > tab, choose View Code, paste the code in the window that opens,
> > then click the XL icon on the toolbar to return to XL):
> >
> >
> > Option Explicit
> > Dim gvOldFormula As Variant
> >
> > Private Sub Worksheet_Activate()
> > Dim i As Long
> > Dim j As Integer
> > With Range("B2:R99")
> > ReDim gvOldFormula(1 To .Rows.Count, 1 To .Columns.Count)
> > For i = 1 To UBound(gvOldFormula, 1)
> > For j = 1 To UBound(gvOldFormula, 2)
> > If .Cells(i, j).HasFormula Then
> > gvOldFormula(i, j) = .Formula
> > Else
> > gvOldFormula(i, j) = "="
> > End If
> > Next j
> > Next i
> > End With
> > End Sub
> >
> > Private Sub Worksheet_Change(ByVal Target As Excel.Range)
> > With Target
> > If .Count > 1 Then Exit Sub
> > If Not Intersect(.Cells, Range("B2:R99")) Is Nothing Then
> > If IsNumeric(.Value) Then
> > Application.EnableEvents = False
> > .Value = gvOldFormula(.Row - 1, .Column - 1) & _
> > "+" & .Value
> > Application.EnableEvents = True
> > gvOldFormula(.Row - 1, .Column - 1) = .Formula
> > End If
> > End If
> > End With
> > End Sub
> >
> >
> > In article
> > <3fae2f80$0$23152$(E-Mail Removed)>,
> > "Mario" <(E-Mail Removed)> wrote:
> >
> > > hi
> > > i have the following problem but no solution,
> > >
> > > i want to format the cells B2:R99 as follow
> > > for example B4 (like all others) if u enter a number it should add it
> > > automatically for example:
> > >
> > > Step1: input in B4 of 4 - output: 4 - algorithmus in formulr

> bar:
> > > 4
> > > Step1: input in B4 of 5 - output: 9 - algorithmus in formulr

> bar:
> > > =4+5
> > > Step1: input in B4 of 3 - output 12 -algorithmus in formulr

bar
> =
> > > 4+5+3
> > > Step1: input in B4 of -4 output 8 - algorithmus in formulr

> bar
> > > =4+5+3-4
> > >
> > >
> > > i want to create a material list for a project for others, but this

list
> > > contains of 500 positions and 5 tables
> > > but i want these data to be pursue-able . i am not really good in

makro
> > > programming, i have an additions algorithmus makro witch adds but it

> does
> > > not give the algorithmus in the formular bar just the vallue of the

> output,
> > > (for example only vallue 9 instead of '=4+5+7-7')
> > >
> > > hope someone could help me
> > >
> > > kind regards
> > >
> > > mario
> > >
> > >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i see additon sender information. i think i have received KC Bob Microsoft Outlook Discussion 1 12th Jan 2010 05:58 AM
mutiple additon/remove in listboxex using javascript =?Utf-8?B?ZGVlcGFr?= Microsoft ASP .NET 0 16th Feb 2005 01:05 PM
ADDITON TO: Inactive Icons Not Hiding Ed Windows XP Performance 1 19th Sep 2004 04:57 AM
Additon? =?Utf-8?B?VGhvbWFz?= Microsoft Access Getting Started 2 27th Apr 2004 08:52 PM
additon of values automatically Mario Microsoft Excel Programming 2 9th Nov 2003 01:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:01 AM.