Cells addition problem - very hectic

PANKAJUTEKAR

Board Regular
Joined
Jun 10, 2011
Messages
79
Dear All,

I have tryed this code, and also i called this function in workbook event (after save event).

But still i am got any success on this.

Is one of you, sole the problem?

I totally understand the code. but still not understand how to call it.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Call SumKW
ThisWorkbook.Activate
'Dim i As Integer, j As Integer, k As Integer
'Do Until i = 112
' i = 0
' j = 3
'Cells(i, j) = Cells(7, 3)
'k = Left(cell, Len(cell) - 2)
'i = i + 1
'Loop
End Sub

Public Function SumKW(r As Range) As String
'Function will recalculate automatically
Application.Volatile
'Variables for calculations
Dim dCellKWvalue As Double, dTotal As Double
Dim cell As Range
'Sum formula in essence
For Each cell In r
dCellKWvalue = Left(cell, Len(cell) - 2)
dTotal = dTotal + dCellKWvalue
Next cell
'adding kw string to the calculated total
SumKW = dTotal & "kw"
End Function
 
Error still getting - #value?
but forget it....Sirs. The way you help!!
Whatever..But I really Thanks to All and Sektor Sir.
Thanks for your help.
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Sektor Sir,

You are absolutly right.
Awosome....@@@@@
This is working...........You all are Great.
Please accept my friend request.
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,844
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top