LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Functions Trigger

Fantastic. Super Thanks to Tom and Norman.

I love you guys. Have spent several nights to figure it out.

With very best regards,



"Tom Ogilvy" wrote:

Loop should have been next, but it appears that isn't what you want anyway.

You can certainly loop through the column and find the cells that contain
total or grouptotal. Then put your sum in the cell to the right.

Here is some pseudo code to get you going.

set rng = Range("A2",Cells(rows.count,1).End(xlup))
for each cell in rng
if instr(1,cell,"total",vbTextcompare then
cell.offset(0,1).Select
' do your total
end if
Next

--
Regards,
Tom Ogilvy

--
Regards,
Tom Ogilvy


"Frankie" wrote:

An error appeared "loop without do"
In fact, my spreadsheet has 2 columns only, column "A" contains wordings
"total" & "grouptotal" scattered in the column and column "B" a list of
values. I just want to insert an autosum formula adjacent to the
"total/grouptotal" located in column "A". Since the sum ranges vary &
grouptotals are required at times, I can only locate the total/subtotal
manually in column "A" & click autosum in column "B" where the sum ranges
appear. I wonder if VBA can automate this process.

Hope you can help on this.
Thanks & Rgds,

"Tom Ogilvy" wrote:

With limited information, here is a possibility:

Sub DoSums()
Dim StartColumn as Long, EndColumn as Long
Dim i as Long
StartColumn = 3
EndColumn = 12
for i = startcolumn to endcolumn
cells(rows.count,i).End(xlup)(2).Select
DoAutoSum
Loop
End Sub

Public Sub DoAutoSum()
'/// Jim Rech
Dim x As CommandBarControl
Set x = CommandBars.FindControl(id:=226)
If Val(Application.Version) = 10 Then _
Set x = x.Controls(1)
x.Execute
If selection.Cells.Count = 1 Then
x.Execute
End If
End Sub

--
Regards,
Tom Ogilvy

"Frankie" wrote:

Thanks Norman.
It works well.

How can I repeat this VBA command until all autosum formulae are set up in a
column where list of values are there. I want to insert the autosum
formulae with variable sum ranges.


Rgds,

"Norman Jones" wrote:

Hi Frankie,

Try:

'=============
Public Sub DoAutoSum()
'/// Jim Rech
Dim x As CommandBarControl
Set x = CommandBars.FindControl(id:=226)
If Val(Application.Version) = 10 Then _
Set x = x.Controls(1)
x.Execute
If selection.Cells.Count = 1 Then
x.Execute
End If
End Sub
'<<=============


---
Regards,
Norman


"Frankie" wrote in message
...
Dear all,

I am eager to know how can the normal icons like "autosum" be triggered
(just like effect of clicking the icon) in VBA ?

Rgds,



 
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
how to trigger data renegade Excel Worksheet Functions 6 January 22nd 10 11:08 PM
Trigger and Add-in Automatically JackR Excel Discussion (Misc queries) 2 May 4th 08 02:34 PM
trigger help climax Excel Worksheet Functions 1 February 2nd 06 04:39 PM
Trigger a sub when cell changes? No Name Excel Programming 1 October 7th 04 04:58 PM
Trigger code Bourbon[_21_] Excel Programming 5 January 26th 04 04:06 PM


All times are GMT +1. The time now is 09:25 AM.

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"