ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Inserting the values of a formula using vb (https://www.excelbanter.com/excel-programming/441932-inserting-values-formula-using-vbulletin.html)

Ram

Inserting the values of a formula using vb
 
HI All,

Do you know where the error is below

Thanks for any help

With Worksheets("tblFaxMailBox").Range("F2:F" & LASTROW)
.Formula=
"= NETWORKDAYS(RC[-2],RC[-4],Holiday!R2C[-4]:R11C[-4])"
.Value = .Value
End With

Ram

Inserting the values of a formula using vb
 
HI I found the error. I needed to add R1C1

"ram" wrote:

HI All,

Do you know where the error is below

Thanks for any help

With Worksheets("tblFaxMailBox").Range("F2:F" & LASTROW)
.Formula=
"= NETWORKDAYS(RC[-2],RC[-4],Holiday!R2C[-4]:R11C[-4])"
.Value = .Value
End With


Mike H

Inserting the values of a formula using vb
 
Hi,

There's nothing wrong with the code so you should look at how your setting a
value for LastRow. It should be something like

LastRow = Cells(Cells.Rows.Count, "B").End(xlUp).Row

or you may choose to use column D


--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"ram" wrote:

HI All,

Do you know where the error is below

Thanks for any help

With Worksheets("tblFaxMailBox").Range("F2:F" & LASTROW)
.Formula=
"= NETWORKDAYS(RC[-2],RC[-4],Holiday!R2C[-4]:R11C[-4])"
.Value = .Value
End With


Dave Peterson

Inserting the values of a formula using vb
 
If you're going to use that R1C1 reference style, then make sure you use:
.formulaR1C1 =

Not
.formula =



ram wrote:

HI All,

Do you know where the error is below

Thanks for any help

With Worksheets("tblFaxMailBox").Range("F2:F" & LASTROW)
.Formula=
"= NETWORKDAYS(RC[-2],RC[-4],Holiday!R2C[-4]:R11C[-4])"
.Value = .Value
End With


--

Dave Peterson


All times are GMT +1. The time now is 01:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com