Add specific text at the end of all tabs

kriti_kostas

New Member
Joined
Oct 25, 2017
Messages
2
I want to add a specific text at the end of every line in an excel with many tabs.
Tabs have different amount of lines and are random so I need to check if is empty.
Any idea how to succeed with VBA
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Welcome to the Board!

Can you please provide more details?
So, you said each tab may have a different number of rows. That is fine.
However, what about columns?
What are we adding and where?
Will we be adding a new column, and adding something on to the last column?

An actual example of what you are trying to do may help clarify things.
 
Upvote 0
Hello.
Sorry for not being clear.

1. At the moment I don't care about the amount of columns.
2. There are excels with 40-50 tabs (worksheets) ... There are different rows in each tab... Other have 40,50,70 etc.
3. I want at the end of each worksheet (when finish all written rows) leave two blank rows and add a text (is a remark) ...(text is the same in all worksheets).
4. Would be perfect the text would be added at column C
Hope now would be more clear.

Thank you
 
Upvote 0
Assuming that we can use column A to determine where the last row on each sheet is (that can be changed, if need be), this should work.
Code:
Sub MyAddText()

    Dim ws As Worksheet
    Dim lastRow As Long
    
    Application.ScreenUpdating = False
    
'   Loop through all sheets
    For Each ws In Worksheets
'       Find last row on sheet by looking at column A
        lastRow = ws.Cells(Rows.Count, "A").End(xlUp).Row
'       Add text to column C three rows down from last row
        ws.Cells(lastRow + 3, "C") = "Add text here"
    Next ws
    
    Application.ScreenUpdating = True
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,325
Members
452,635
Latest member
laura12345

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