Performing codes on different worksheets

  • Thread starter Thread starter Darren
  • Start date Start date
D

Darren

Anyone knows how to select a worksheet and perform
subsequent operations from that worksheet?

Ive used the below code to test out:
Sheets("Average(daily)").Select
Cells(10, 10).Value = 1

What it does is that it selects "average(daily)"
worksheet, but continues to change the value of cell
(10,10) of the original worksheet. How do I get it to work
on the new worksheet, "Average(daily)"?
 
You can avoid the select:

Sheets("Average(daily)").Cells(10, 10).Value = 1

or
with Sheets("Average(daily)")
.Select
.Cells(10, 10).Value = 1
end with

It looks like your code is behind a worksheet (event code or assigned to a
control from the control toolbox toolbar).

Unqualified ranges refer to the sheet that owns the code. In a general module,
unqualified ranges refer to the activesheet.
 
Hi Darren

works fine for me ... as you've written it, but how about
simply
Sheets("Average(daily)").Cells(10, 10).Value = 1

Cheers
JulieD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top