Identify Spreadsheet and change the Spreadsheet name?

nonono

Board Regular
Joined
Jul 25, 2018
Messages
59
As you can see in the image, as I import some document into the excel spreadsheet it will be name "xxxx"
I would like to automate the process where it will automatically change the spreadsheet name.

If document row is from Row 'A' to Row 'H'change spreadsheet name to "Tester Utilization"
else if
If document row is from Row 'A' to Row 'U' change spreadsheet name to "Lot History"
else if
If document row is from Row 'A' to Row 'L' change spreadsheet name to "Lot Operation Report"
else
If document row does not match the criteria above, change spreadsheet name to "Unknown"

*Hope it does not identify the other spreadsheets, while it changing the spreadsheet name. The other spreadsheet names are "Menu", "Original (2)", "UTP", "Original" and must not be change....

lOd5M6E.png
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Try this:
I assume you mean Row One columns A To H for example
We have no rows A To H
We have rows 1 to 20 for example


Code:
Sub Row_One_Count()
'Modified 7/25/2018 10:25 PM  EDT
Dim lastcolumn As Long
lastcolumn = Cells(1, Columns.Count).End(xlToLeft).Column
If lastcolumn = 8 Then ActiveSheet.Name = "Tester Utilization"
If lastcolumn = 21 Then ActiveSheet.Name = "Lot History"
If lastcolumn = 12 Then ActiveSheet.Name = "Lot Operation Report"
End Sub
 
Upvote 0
Maybe it might be just me but I have copy paste the macro in my visual basic and tried to run the macro but nothing seems to be happening?
 
Upvote 0
You said:
If document row is from
Row 'A' to Row 'H
'change spreadsheet name to "
Tester Utilization
"

To start with we have no such thing as Row A Or Row H

So tell me again what you want.

We have rows like row 1 and row 2
We have columns A and B and C
 
Upvote 0
Now I understand why it didnt work because in the image above "Lot History" there is only 20 column
Not 21 ... excluding the "U" column

Anyway thank you.. for your time sir
Am appreciate it <3
 
Upvote 0
Now I understand why it didnt work because in the image above "Lot History" there is only 20 column
Not 21 ... excluding the "U" column

Anyway thank you.. for your time sir
Am appreciate it <3

So I now believe your saying it works

It looks in Row(1) to find last value

Glad I was able to help you.
Come back here to Mr. Excel next time you need additional assistance.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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