Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default Worksheet reference vs Worksheet("").Activate

Is there a way to avoid changing back and forth between Worksheets in order
to execute a certain command in another work area (Worksheet)?

Is there something that refers to a Worksheet which, if placed before an
ActiveCell statement as is the case below, will refer to the ActiveCell of
another Worksheet and not the current one???? I remember from my Clipper days
that we could precede any function with a Workarea reference and the command
would first switch to the specified workarea, execute and then return to the
current workarea by itself.

Example
----------
Case : Move records of a specific invoice from a database to another
worksheet for reporting. Locate an invoice, "walk" through it moving its
items to the Report Worksheet one by one, and then move on...

.....
Worksheet("Data").Activate
loadLine = 1
While Left(ActiveCell.Value, workKeyLen) = workKey

work1 = ActiveCell.Offset(0, 6).Value
work2 = ActiveCell.Offset(0, 7).Value
work3 = ActiveCell.Offset(0, 8).Value

Worksheets("Report").Activate
ActiveCell.Offset(loadLine, 0).Value = work1
ActiveCell.Offset(loadLine, 1).Value = work2
ActiveCell.Offset(loadLine, 2).Value = work3
Worksheets("Data").Activate

ActiveCell.Offset(1, 0).Activate
loadLine = loadLine + 1

Wend

Can I do without the 2 Worksheet.Activate(s)???
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Worksheet reference vs Worksheet("").Activate

Sure. You can move data just like this without activating any of the sheets:

Worksheets("Report").Range("A2").Value =
Worksheet("Data").Range("C14").Value
or
Worksheets("Report").Cells(2, 1).Value = Worksheet("Data").Cells(14,
3).Value
or a combination of the two.

HTH. Best wishes Harald

"DoctorG" skrev i melding
...
Is there a way to avoid changing back and forth between Worksheets in

order
to execute a certain command in another work area (Worksheet)?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reference cell in the "next" worksheet (regardless of name)? DBH1 Excel Discussion (Misc queries) 1 August 21st 09 05:08 AM
reference cell from previous worksheet without "naming" worksheet Kristin Excel Worksheet Functions 3 August 20th 07 08:30 PM
Macro to Create New Worksheet and Reference Cell in Old Worksheet As Tab Name - "Object Required" Error [email protected] Excel Discussion (Misc queries) 4 September 25th 06 01:35 PM
CommandBars("Worksheet Menu Bar").Controls("Tools").Enabled = Fals Arturo Excel Programming 3 May 26th 05 05:44 PM
Excel VBA - go to worksheet "name" based on a cell reference ="Name" james007 Excel Programming 2 July 8th 04 11:04 PM


All times are GMT +1. The time now is 06:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"