Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Excel VBA modification

Posted on 2013-11-15
2
Medium Priority
?
272 Views
Last Modified: 2013-11-15
I recently changed the Position of my amount originally in J2 and all subsequent ones to the H2 Cell... I have the following code that adds a formula storting in J4 that does H4/J$2 but now that I moved this I need the formula to look at H4/H$4 .... How can I modify this code to accomplish this?  

Dim vRow As Long
 vRow = Cells(Rows.Count, 10).End(xlUp).Row
 Intersect(Rows("4:" & vRow), Range("J:J,N:N,R:R,V:V,Z:Z,AD:AD,AH:AH,AL:AL,AP:AP,AT:AT,AX:AX,BB:BB")).FormulaR1C1 = "=RC[-2]/R2C"

Open in new window

Hours-Input-Ver-3.1-Revised.xlsm
0
Comment
Question by:joeserrone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

Accepted Solution

by:
mvidas earned 2000 total points
ID: 39651783
Hi Joe,

The part of that which has the formula is "=RC[-2]/R2C"
That uses "r1c1" notation, which refers to rows and columns (both absolute references, and relative to where the cell is). The "RC[-2]" means "same row, 2 columns to the left" which is what references column H from J.
"R2C" means "row 2, same column" which is what is J2. You should change it to R2C[-2] which would be H$2 (or "same column as the numerator, but row 2 of that column instead"

Matt

EDIT: if you always want the demoninator to be $H$2, then change R2C to R2C8. Doesn't sound like that's exactly what you want though.
0
 

Author Closing Comment

by:joeserrone
ID: 39651954
Thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question