#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default Hardcode

Hello. Given the following code, how can I have the result of the
formulas hardcoded? I tried simply adding .value at the end of each,
but that did not work! Thanks!

LastRow = Worksheets("Log").Cells(Cells.Rows.Count, "A").End(xlUp).Row

With Worksheets("Log")
.Range("A" & LastRow + 1).Formula = "='Extended Terms'!C8"
.Range("B" & LastRow + 1).Formula = "='Extended Terms'!C6"
.Range("C" & LastRow + 1).Formula = "='Extended Terms'!C5"
.Range("D" & LastRow + 1).Formula = "='Extended Terms'!C7"
.Range("E" & LastRow + 1).Formula = "='Extended Terms'!C17"
.Range("F" & LastRow + 1).Formula = "='Extended Terms'!C23"
.Range("G" & LastRow + 1).Formula = "='Extended Terms'!C11"
.Range("H" & LastRow + 1).Formula = "='Extended Terms'!C77"
.Range("I" & LastRow + 1).Formula = "='Extended Terms'!C12"
.Range("J" & LastRow + 1).Formula = "='Extended Terms'!I8"
.Range("K" & LastRow + 1).Formula = "='Extended Terms'!I7"
End With
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Hardcode

Instead of lines like this:

..Range("A" & LastRow + 1).Formula = "='Extended Terms'!C8"

You could use:
..Range("A" & LastRow + 1).value = worksheets("extended terms").range("C8").value

Depending on what's in those cells, you may want:

with .Range("A" & LastRow + 1)
.numberformat = worksheets("extended terms").range("C8").numberformat
.value = worksheets("extended terms").range("C8").value
end with



Steve wrote:

Hello. Given the following code, how can I have the result of the
formulas hardcoded? I tried simply adding .value at the end of each,
but that did not work! Thanks!

LastRow = Worksheets("Log").Cells(Cells.Rows.Count, "A").End(xlUp).Row

With Worksheets("Log")
.Range("A" & LastRow + 1).Formula = "='Extended Terms'!C8"
.Range("B" & LastRow + 1).Formula = "='Extended Terms'!C6"
.Range("C" & LastRow + 1).Formula = "='Extended Terms'!C5"
.Range("D" & LastRow + 1).Formula = "='Extended Terms'!C7"
.Range("E" & LastRow + 1).Formula = "='Extended Terms'!C17"
.Range("F" & LastRow + 1).Formula = "='Extended Terms'!C23"
.Range("G" & LastRow + 1).Formula = "='Extended Terms'!C11"
.Range("H" & LastRow + 1).Formula = "='Extended Terms'!C77"
.Range("I" & LastRow + 1).Formula = "='Extended Terms'!C12"
.Range("J" & LastRow + 1).Formula = "='Extended Terms'!I8"
.Range("K" & LastRow + 1).Formula = "='Extended Terms'!I7"
End With


--

Dave Peterson
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
Y Axis : Dynamically Hardcode Min/Max Values? RayportingMonkey Charts and Charting in Excel 1 February 21st 08 06:06 PM
hardcode a column in a formula AHizon via OfficeKB.com Excel Worksheet Functions 2 October 16th 07 01:33 AM
Hardcode Steph Excel Programming 2 September 5th 06 03:28 PM
Hardcode Links - edit my code please? Steph[_6_] Excel Programming 1 October 26th 05 04:14 PM
Change hardcode to ....? Stuart[_21_] Excel Programming 3 April 30th 05 05:53 PM


All times are GMT +1. The time now is 09:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"