Solved

Fixing a procedure result.

Posted on 2013-11-13
6
243 Views
Last Modified: 2013-11-13
How come in the following the result is zero, instead of =Base?  I am loading a value in the cell that is named "Base" after this runs.

Range("AT7").Select
    ActiveCell.FormulaR1C1 = "=Base"
    Range(ActiveCell, Cells(Rows.Count, ActiveCell.Column - 1).End(xlUp).Offset(, 1)).Value = ActiveCell.Value

Is there a way to, when a value is added to AT7, a script like this run, and put them in as values instead of a formula?

Interested to both solutions.  Please advise and thanks. -R-
0
Comment
Question by:RWayneH
  • 3
  • 2
6 Comments
 
LVL 35

Expert Comment

by:Kimputer
ID: 39644809
Second part of your question. Not sure about the first, for me it's zero, only if you didn't have a Named range. If you have a named range (single cell, otherwise you will get error again), it will have the correct display value (and correct formula)
   ActiveCell.FormulaR1C1 = Range("Base").Value

Open in new window

0
 

Author Comment

by:RWayneH
ID: 39644824
It is a single cell...  and the value is zero when the formula is added, however when I added the actual value.. because there is a value in the column instead of a formula it does not chg all the column to whatever I put in AT7.  I want of whatever is placed in AT7 to copy to the cells that have the =Base in it.   AT7 is named Base.  Does this help? -R-
0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 39644828
You are replacing your formula with a value before you assign a value to Base so the value you replace the formula with will be 0. Perhaps you just want:

Range("AT7", Cells(Rows.Count, "AS").End(xlUp).Offset(, 1)).Formula = "=Base"

Open in new window

0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

 

Author Comment

by:RWayneH
ID: 39644833
I am expecting the formula to be copied down, not a value, perhaps I need to add the formula inside the copy down part? -R-
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 39644853
The code I posted will put the formula in all the cells.
0
 

Author Closing Comment

by:RWayneH
ID: 39644922
EXCELent... worked great.  Thanks. -R-
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

791 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