CHANGING "SET ws=SHEETS(" ") TO ACCEPT ANY SHEET NAME

JuicyMusic

Board Regular
Joined
Jun 13, 2020
Messages
210
Office Version
  1. 365
Platform
  1. Windows
Hello Guru's, I would like to know how to change the ws line of code in a code that I have been using.

Here is the line of code that I need to learn how to adjust: Set ws = Sheets("Renewal Log")



Dim ws As Worksheet
Dim Status As String
Set ws = Sheets("Renewal Log")
lr = ws.Range(A") & Rows.count).End(xlUp).Row

Please show me how to change this line so that the activated sheet can be called anything at all.
Thank you so much in advance,

Juicy,
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
I'm not sure I understand the problem? Just put whatever you want inside the quotation marks?
 
Upvote 0
I'm not sure I understand the problem? Just put whatever you want inside the quotation marks?
Hello, I think I was very clear. I wrote "Please show me how to change this line so that the activated sheet can be called anything at all."
 
Upvote 0
Does this work for you?
VBA Code:
Dim ws As Worksheet
Dim Status As String
Set ws = ActiveSheet
lr = ws.Range(A") & Rows.count).End(xlUp).Row
 
Upvote 0
Solution
Yes, thank you mumps! That is exactly what I was asking for. Thank you for responding to me.
Juicy,
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,718
Members
448,986
Latest member
andreguerra

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