Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Edit Cell with "/2"

Once subtotals are initiated, can navigate to a GrandTotal cell [know how to
do that] but then ...

Have VBA edit that cell adding "/2" to the end of it ... effectively
dividing it by 2 ... whichever cell it ends up being, which is frequently a
different row.

Have been able to accomplish that, but only with a fixed cell address.

Any assistance will be sincerely appreciated.

-Mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Edit Cell with "/2"

I'm not completely sure what you meant by "once subtotals are initiated".
What is in your GrandTotal cell... a value or a formula?

If a value, try this subroutine (after selecting the GrandTotal cell)...

Sub HalfValue()
ActiveCell.Value = ActiveCell.Value / 2
End Sub

If a formula, try this (again, after selecting the GrandTotal cell)...

Sub HalfFormula()
ActiveCell.Formula = ActiveCell.Formula & "/2"
End Sub

If something else, then please describe your situation in more detail.

--
Rick (MVP - Excel)


"MikeF" wrote in message
...
Once subtotals are initiated, can navigate to a GrandTotal cell [know how
to
do that] but then ...

Have VBA edit that cell adding "/2" to the end of it ... effectively
dividing it by 2 ... whichever cell it ends up being, which is frequently
a
different row.

Have been able to accomplish that, but only with a fixed cell address.

Any assistance will be sincerely appreciated.

-Mike


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Edit Cell with "/2"


Rick,

The Sub HalfFormula() worked great.
Thank you, and to all other replies!!

- Mike


"Rick Rothstein" wrote:

I'm not completely sure what you meant by "once subtotals are initiated".
What is in your GrandTotal cell... a value or a formula?

If a value, try this subroutine (after selecting the GrandTotal cell)...

Sub HalfValue()
ActiveCell.Value = ActiveCell.Value / 2
End Sub

If a formula, try this (again, after selecting the GrandTotal cell)...

Sub HalfFormula()
ActiveCell.Formula = ActiveCell.Formula & "/2"
End Sub

If something else, then please describe your situation in more detail.

--
Rick (MVP - Excel)


"MikeF" wrote in message
...
Once subtotals are initiated, can navigate to a GrandTotal cell [know how
to
do that] but then ...

Have VBA edit that cell adding "/2" to the end of it ... effectively
dividing it by 2 ... whichever cell it ends up being, which is frequently
a
different row.

Have been able to accomplish that, but only with a fixed cell address.

Any assistance will be sincerely appreciated.

-Mike



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 791
Default Edit Cell with "/2"

Assuming your Grand total is in Column D

In your code do this:
Dim iLastRow as integer

iLastRow=Range("D65536").end(xlup).row
This will provide you a dynamic Last Row Cell Reference, then you can
substitute your fixed cell reference to something like:

Range("D"& iLastRow).value = "=" & Range("D" &ILastRow).value & "/2"
--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"MikeF" wrote:

Once subtotals are initiated, can navigate to a GrandTotal cell [know how to
do that] but then ...

Have VBA edit that cell adding "/2" to the end of it ... effectively
dividing it by 2 ... whichever cell it ends up being, which is frequently a
different row.

Have been able to accomplish that, but only with a fixed cell address.

Any assistance will be sincerely appreciated.

-Mike

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Edit Cell with "/2"

You would probably have to use a relative reference to some point that you
know for sure, or a named reference. Look in VBA help under Referring to
Cells Relative to Other Cells and How to Reference Cells and Ranges. There
are illustrations in both these help files that can give you some ideas on
how to do it.
"MikeF" wrote:

Once subtotals are initiated, can navigate to a GrandTotal cell [know how to
do that] but then ...

Have VBA edit that cell adding "/2" to the end of it ... effectively
dividing it by 2 ... whichever cell it ends up being, which is frequently a
different row.

Have been able to accomplish that, but only with a fixed cell address.

Any assistance will be sincerely appreciated.

-Mike



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
why do i "sometimes" need to "edit chart object" before "source da Flirty and Blonde Charts and Charting in Excel 1 February 2nd 10 02:07 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Lost "File Menu" - now it's "Edit / View / Insert.." but no "F daves Excel Discussion (Misc queries) 3 April 24th 07 04:52 AM
Make "Edit" mode default, rather than "Enter"? Greg Boettcher Excel Discussion (Misc queries) 1 July 27th 06 01:46 AM
How do I get "file" tab to click on, it starts with "edit" JMD_Phoenix Excel Discussion (Misc queries) 1 January 23rd 06 02:46 AM


All times are GMT +1. The time now is 09:17 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"