Enter Description below "NET PROFIT / LOSS"

Panoos64

Well-known Member
Joined
Mar 1, 2014
Messages
890
Hi everyone, i would like to enter the description "Occupancy" below NET PROFIT / LOSS using a vba code. Please note that the rows are not stable. The Schedule 1. shows the original data and schedule 2. is the expected result. Many thanks in advance

Schedule 1.

Accommodation
Food Income
Beverage Income
Fuel & Gaz
Laundry Expenses
Printing & Stationery
Postages & Transportations
Finance Expenses
Bank Loan Charges
Bank Overdraft A/C Charges
Bank Interest Loans
Bank Interest Overdraft A/C

<tbody>
[TD="align: center"][/TD]
[TD="width: 157"]A[/TD]

[TD="align: center"]1[/TD]
[TD="class: xl64"]Income[/TD]

[TD="align: center"]2[/TD]

[TD="align: center"]3[/TD]

[TD="align: center"]4[/TD]

[TD="align: center"]5[/TD]

[TD="align: center"]6[/TD]
[TD="class: xl64"]Expenses[/TD]

[TD="align: center"]7[/TD]

[TD="align: center"]8[/TD]

[TD="align: center"]9[/TD]

[TD="align: center"]10[/TD]

[TD="align: center"]11[/TD]

[TD="align: center"]12[/TD]

[TD="align: center"]13[/TD]

[TD="align: center"]14[/TD]

[TD="align: center"]15[/TD]

[TD="align: center"]16[/TD]

[TD="align: center"]17[/TD]

[TD="align: center"]18[/TD]
[TD="class: xl63"]NET PROFIT / LOSS[/TD]

</tbody>



Schedule 2.
Accommodation
Food Income
Beverage Income
Fuel & Gaz
Laundry Expenses
Printing & Stationery
Postages & Transportations
Finance Expenses
Bank Loan Charges
Bank Overdraft A/C Charges
Bank Interest Loans
Bank Interest Overdraft A/C
Occupancy

<tbody>
[TD="align: center"][/TD]
[TD="width: 249"]A [/TD]

[TD="align: center"]1[/TD]
[TD="class: xl66"]Income[/TD]

[TD="align: center"]2[/TD]

[TD="align: center"]3[/TD]

[TD="align: center"]4[/TD]

[TD="align: center"]5[/TD]

[TD="align: center"]6[/TD]
[TD="class: xl66"]Expenses[/TD]

[TD="align: center"]7[/TD]

[TD="align: center"]8[/TD]

[TD="align: center"]9[/TD]

[TD="align: center"]10[/TD]

[TD="align: center"]11[/TD]

[TD="align: center"]12[/TD]

[TD="align: center"]13[/TD]

[TD="align: center"]14[/TD]

[TD="align: center"]15[/TD]

[TD="align: center"]16[/TD]

[TD="align: center"]17[/TD]

[TD="align: center"]18[/TD]
[TD="class: xl65"]NET PROFIT / LOSS[/TD]

[TD="align: center"]19[/TD]

[TD="align: center"]20[/TD]

</tbody>
 
Last edited:

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Try this:
Code:
Sub Test()
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 1 To Lastrow
        If Cells(i, 1).Value = "NET PROFIT / LOSS" Then Cells(i, 1).Offset(2).Value = "Occupancy"
        Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Thank you so much My Answer. It works perfect and nicely. Also many thanks for your time spent for my project. Have a great day!
 
Upvote 0
Glad I was able to help you. Come back here to Mr. Excel next time you need additional assistance.
Thank you so much My Answer. It works perfect and nicely. Also many thanks for your time spent for my project. Have a great day!
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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