can anyone help me with this string of code? I need to tweak it but need to know what it means first? Thank you!!!!
Please Login or Register to view this content.
can anyone help me with this string of code? I need to tweak it but need to know what it means first? Thank you!!!!
Please Login or Register to view this content.
Last edited by Leith Ross; 07-21-2010 at 05:01 PM. Reason: Added Code Tags
Given the snippet it's pretty much impossible for anyone to give you detailed analysis, however, what we can say is:
Target : will be a Range reference of some sort (presumably in Col B)
(we don't know if this is a Change Event driven piece of code or someone has decided to name a variable Target)
bAddSupport: will be a Boolean variable (ie True/False)
ws: will be a Worksheet variable
The code essential states that if bAddSupport is True
then to offset from the Target range by 2 cells in a downwards direction and set that cell to contain value "Support & Maintenance".Please Login or Register to view this content.
Then using the "ws" worksheet...Please Login or Register to view this content.
use the Range B10 to ? where ? is determined by offsetting from the Target range by 8 columns to the rightPlease Login or Register to view this content.
then:Please Login or Register to view this content.
-- Offset from the original Target Range by 3 cells in a downwards direction and and subsequently resize that resulting Range by the number of rows identified in the B10:? range and to 9 columns in width
-- to that range assign the value of the B10:? range
-- Then offset from the Target range by 3 rows in a downwards direction and 4 columns to the right and subsequently resize the resulting range by the number of rows identified in the B10:? range and to 4 columns in widthPlease Login or Register to view this content.
-- to that range assign the formula specifiedPlease Login or Register to view this content.
uses R1C1 notation and basically uses a relative cell reference determined by the inverse of the number of rows previously identified in the B10:? range + 2 further rows and the current column - the value of which is then multiplied by the value as stored in the Support Named Range / ConstantPlease Login or Register to view this content.
To elaborate - if current cell was say D30 and there were 10 rows in B10:? range then the above would read in D30 as:
=D18*Support
ie D30 offset upwards by 12 rows
For more info. on R1C1 notation - I put together a very brief overview a while back:
http://www.excelforum.com/2171545-post2.html
Last edited by DonkeyOte; 07-22-2010 at 03:02 AM. Reason: added CODE snippets for clarity
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
this is super helpful!!!! It's doing exactly what you explained - I've been tasked with tweaking this and can see what it's doing but didn't understand the written code. I just posted another post wondering if it's possible for that same set of code to look at another sheet and pull those results into this sheet? I'm wondering if I just need to somehow tweak this row of code? It's always going to be a moving target depending on how many choices people make so B10 is really the starting point. -- Thanks again!
.FormulaR1C1 = "=R[-" & .Rows.Count + 2 & "]C * Support"
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks