Formula to always be in row where specfic account is

howard

Well-known Member
Joined
Jun 26, 2006
Messages
6,595
Office Version
  1. 2021
Platform
  1. Windows
I have a formula in E4 in Sheet Summary in same row where account KX-1081 appears in COL A which is generated by VBA

I would like to text and formula to always be in the same row where KX-1081 appears in Col A on workbook Check Balance KX-1081.xlsm


Code:
 Sub Formula()
With Sheets("Sheet1")
    .Range("E4").FormulaR1C1 = "Opening Bal "
    .Range("F4").FormulaR1C1 = "=VLOOKUP(RC1&"""",'[TB 2019.xlsx]Sheet1'!C1:C6,COLUMNS(C1:C),FALSE)"
    .Range("G4").FormulaR1C1 = "Closing Bal"
    .Range("H4").FormulaR1C1 = "=VLOOKUP(RC1&"""",'[TB 2019.xlsx]Sheet1'!C1:C6,COLUMNS(C1:C[-4]),FALSE)"
    .Range("I4").FormulaR1C1 = "=+RC[-3]-RC[-1]"
    .Range("J4").FormulaR1C1 = "=RC[-6]+RC[-1]"
    .Range("K4").FormulaR1C1 = "=IF(RC[-1]<0.00005,""In balance"",""Not in Balance-Please re-download reports and re-import"")"
    End With
    
End Sub


It would be appreciated if someone could kindly assist me


I have also posted on
https://www.excelforum.com/excel-pr...lways-be-in-row-where-specfic-account-is.html
 
Last edited:

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
How about like
Code:
Sub Howard()
    Dim Fnd As Range
    With Sheets("Sheet1")
        Set Fnd = .Range("A:A").Find("KX-1081", , , xlWhole, , , False, , False)
        Fnd.Offset(, 4).Value = "Opening Bal "
        Fnd.Offset(, 5).FormulaR1C1 = "=VLOOKUP(RC1&"""",'[TB 2019.xlsx]Sheet1'!C1:C6,COLUMNS(C1:C),FALSE)"
    End With
End Sub
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top