I used this code and i met with an error this code is if perfect but what this code is doing is suppose coulmn H has data till h20 then this formula is giving the result till n20 and q20 in values but after that also after n20 and q20 also formula is usedCode:Sub calculation() Dim wb1 As Workbook, Ws1 As Worksheet, lr1 As Long Set wb1 = Workbooks.Open(ThisWorkbook.Path & "\FundsCheck.xlsb") Set Ws1 = wb1.Worksheets.Item(1) Let lr1 = Ws1.Range("H" & Ws1.Rows.Count).End(xlUp).Row Ws1.Range("N2:N" & lr1 & "").Value = "=H2/M2" Ws1.Range("N2:N" & lr1 & "").Value = Ws1.Range("N2:N" & lr1 & "").Value Ws1.Range("Q2:Q" & lr1 & "").Value = "=N2*P2" Ws1.Range("Q2:Q" & lr1 & "").Value = Ws1.Range("Q2:Q" & lr1 & "").Value wb1.Save wb1.Close End Sub




Reply With Quote

Bookmarks