Hardcode

S

Steve

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
 
D

Don Guillett

Please give YOUR definition of "hardcoded" If you mean you want to leave the
values instead of the formulas then
either change to values when finished

..Range(cells("A",LastRow + 1),cells("k",lastrow+1)).value = _
..Range(cells("A",LastRow + 1),cells("k",lastrow+1)).value

or this idea

..Range("A" & LastRow + 1).value= sheets("Extended Terms").range("C8")
 
D

Dave Peterson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top