Hello,

I have a layout and i have to paste information on that layout, in that lay i have Columns H, P

i have a formula in column P like this

=IF(ISERROR(P3/H3),0,P3/H3)

but when i insert the information obtained in VBN to EXCEL worksheet it pastes the information just fine, the only problem is that the formula above is erased.

I want to know how can I paste that formula and leave it into the excel worksheet when the file is being saved in VBN.

i tried using this

For row As Integer = 2 To 239
    exlWsh.Cells(row, 17) = "=IF(ISERROR(P" + row + "/H" + row + "),0,P" + row + "/H" + row + ")"

Next

the reason why i am using this is because i have 238 columns where the formula has to be pasted, in Column H there is no data, that data is gonna be pasted manually after this file is generated, but i want to leave that formula there when they paste the information on Column H.

Any help would be appreciated, thanks in advance.

Re: HELP with EXCEL and VBN 80 80

hi darkelflemurian, have you tried pasting the VBN data first then after that apply the formula. check if it works :)

Re: HELP with EXCEL and VBN 80 80

hi darkelflemurian, have you tried pasting the VBN data first then after that apply the formula. check if it works :)

I'll give it a try and let you know if it worked, thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.