Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 32
Default VBA Range definition: Code needed

Richard,

Thanks for your help. I've been playing with lot's of code, so this is
helpful!

"Richard M Burton" wrote:

Sorry David,

I have been off line for a while.

I tyhink you probably have this licked by now but just in case:

Sum = Application.WorksheetFunction.Sum(Range("F11",
Range("F11").End(xlDown)))
Let Range("g2").Value = Sum

This would work.
Good luck
"David B" wrote:

Richard,

Thanks for your reply. When I put in this code (I've changed cell A1 to G2
in my spreadsheet):

Let G2 = Application.WorksheetFunction.Sum(Range("F11",
Range("F11").End(xlDown)))

I get a compile error: Variable not defined.

sorry, but I'm a rookie at this..

"Richard M Burton" wrote:

Hello David,

This should give you the sum of the column you are needing.

Let A1 = Application.WorksheetFunction.Sum(Range("F11",
Range("F11").End(xlDown)))

then

= G1 - A1 + G2

Feel free to change the cell to which you allocate the sum.

Good Luck
Richard

"David B" wrote:

I'm new to using VBA, and am trying to create some code to run a daily macro.
The element of the code I'm stuck on is this: I import a daily excel sheet
where I need to have a simple formula that is:

=G1-Sum of "Range"+G2

The "Range" I need to define always starts with cell F11, and runs down the
F Column a variable number of cells. If I do this manually, I choose F11,
then hit Ctrl+shift+down arrow to select the range to the end of the data,
then apply the SUM function to that range:

So 2 questions:

1.what is the code the define the Range from F11 to the end of the data,
2. What is the construct of the formula (above) to include the SUM of that
Range?

Thanks for any help you can provide!

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
VBA code to affect value of a named range Dave O Excel Discussion (Misc queries) 5 August 25th 06 10:12 PM
2 Questions John Calder New Users to Excel 18 August 24th 06 04:17 AM
Change case...help please Terry Excel Worksheet Functions 14 October 2nd 05 12:29 PM
School-boy secret code help needed Anthony Slater Excel Discussion (Misc queries) 5 May 23rd 05 02:56 PM
formula / code help needed Paul Watkins Excel Discussion (Misc queries) 2 March 16th 05 08:27 PM


All times are GMT +1. The time now is 02:38 PM.

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"