Select sheet from offset of a variable

Lidget

New Member
Joined
Apr 14, 2021
Messages
13
Office Version
  1. 2013
Platform
  1. Windows
Hi.
I have a book with multiple sheets, 6 are dumps of source data and 50 are worksheets I want to populate from the source.
I have a control sheet and in column c are the 50 worksheets and column d contains the related source sheet name.

I have the following code (kindly suggested here) to clear old info from the worksheets

Sub Lidget()
Dim Cl As Range
Dim UsdRws As Long

With Sheets("Control")
For Each Cl In .Range("C4", .Range("C" & Rows.Count).End(xlUp))
If Cl.Value <> "" Then
If Evaluate("isref('" & Cl.Value & "'!A1)") Then
Sheets(Cl.Value).Range("A1:F10").clearcontents

End If
End If
Next Cl
End With
End Sub

Now I'm trying to repeat this but with
Sheets(Cl.offset(0, 1).Value).Range("A1:F10").Copy
Sheets(Cl.Value).Range("A1:F10").paste

But I'm getting "object doesn't support this property or method"
I've tried making the offset of c1 a variable but I'm even worse with variables
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Why not try create a variable to replace:
A= Cl.Offset(0,1).Value
then substitute
Sheets(A).Range("A1:F10").Copy

I guess you've tried. Not read properly
 
Upvote 0
Why not try create a variable to replace:
A= Cl.Offset(0,1).Value
then substitute
Sheets(A).Range("A1:F10").Copy

I guess you've tried. Not read properly
Yeah I finally got around it with the variables. Wants dim'ing as worksheet >_<
 
Upvote 0
You were getting the error because this line Sheets(Cl.Value).Range("A1:F10").paste should be Sheets(Cl.Value).Range("A1:F10").PasteSpecial
 
Upvote 0
Solution

Forum statistics

Threads
1,214,920
Messages
6,122,264
Members
449,075
Latest member
staticfluids

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