set worksheet in range

ummjay

Board Regular
Joined
Oct 1, 2010
Messages
147
hey guys,
how can i set an entire worksheet into a range?

I tried this, but it's not working:

Code:
For i = 3 To Worksheets.Count
Set wksTemp = Worksheets(i)
With wksTemp
setMSG2 = wksTemp.UsedRange
.HTMLBody = strMSG & strMSG2

maybe i need to set setMSG2 as something else? Or maybe it's the way i'm trying to display on .HTMLBody? I'm not getting an erorr, its just not showing anything. Everything else in my code works fine, this is just a piece.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

ummjay

Board Regular
Joined
Oct 1, 2010
Messages
147
i also tried:

Code:
For i = 3 To Worksheets.Count
        Set wksTemp = Worksheets(i)
        With wksTemp
        
        Set rng = .Range("B2")
        strMSG = Sheets("RUN").Range("B8").Value
        strSUBJ = Sheets("RUN").Range("B6").Value
        'page range
        lr = Cells(Rows.Count, "B").End(xlUp).Row
        lc = Cells(1, Columns.Count).End(xlToLeft).Column
        strMSG2 = Range("A1").Resize(lr, lc)

it's not liking my lr or lc. any ideas?
 
Upvote 0

Forum statistics

Threads
1,191,216
Messages
5,985,319
Members
439,957
Latest member
khaled shafy

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
Top