Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default use of range and activate

I have a spreadsheet that I am developing to add data extracted from
database to various sheets. One procedure I have written clears ol
results from the sheet - see below. The problem is more of a
annoyance than anything else but the vba code I have written means tha
each sheet is displayed and, because I'm doing more than one sheet, th
screen goes crazy. I've tried turning of screen updatin
(Application.ScreenUpdating = False) but this doesn't seem to have muc
effect. What I am trying to achieve is to excute the vba code fro
the first sheet as a kind of menu and to have the sheets updated behin
it in the background. It looks like it should be possible but I can'
find the code to make it happen. Any suggestions?

Clive

With Worksheets("sheet2")
.Activate
With ActiveSheet
.Range("A1").Activate
.Range("A1", Selection.End(xlToRight)).Select
.Range(Selection, Selection.End(xlDown)).ClearContents
End With
End Wit

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 320
Default use of range and activate

Run from any worksheet active:
Worksheets("Sheet2").Range("A1").CurrentRegion.Cle arContents
(yes, all done in one line!)
Bob Umlas
Excel MVP

"crichardson " wrote in message
...
I have a spreadsheet that I am developing to add data extracted from a
database to various sheets. One procedure I have written clears old
results from the sheet - see below. The problem is more of an
annoyance than anything else but the vba code I have written means that
each sheet is displayed and, because I'm doing more than one sheet, the
screen goes crazy. I've tried turning of screen updating
(Application.ScreenUpdating = False) but this doesn't seem to have much
effect. What I am trying to achieve is to excute the vba code from
the first sheet as a kind of menu and to have the sheets updated behind
it in the background. It looks like it should be possible but I can't
find the code to make it happen. Any suggestions?

Clive

With Worksheets("sheet2")
Activate
With ActiveSheet
Range("A1").Activate
Range("A1", Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).ClearContents
End With
End With


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default use of range and activate

Hi clive
try
sub foo()
dim wks as worksheet
dim rng as range

For each wks in activeworkbook.worksheets
set rng = wks.Range(wks.Cells(1,1),wks.Range("A1").End(xlToR ight))
set rng = wks.range(rng,rng.End(xlDown))
rng.ClearContents
next
end sub



--
Regards
Frank Kabel
Frankfurt, Germany

I have a spreadsheet that I am developing to add data extracted from

a
database to various sheets. One procedure I have written clears old
results from the sheet - see below. The problem is more of an
annoyance than anything else but the vba code I have written means
that each sheet is displayed and, because I'm doing more than one
sheet, the screen goes crazy. I've tried turning of screen updating
(Application.ScreenUpdating = False) but this doesn't seem to have
much effect. What I am trying to achieve is to excute the vba code
from the first sheet as a kind of menu and to have the sheets updated
behind it in the background. It looks like it should be possible but
I can't find the code to make it happen. Any suggestions?

Clive

With Worksheets("sheet2")
Activate
With ActiveSheet
Range("A1").Activate
Range("A1", Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).ClearContents
End With
End With


---
Message posted from http://www.ExcelForum.com/


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default use of range and activate

Ah... I can tell you guys do a lot more of this stuff than I do!
Thanks.

Cliv

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default use of range and activate

Ah... I can tell you guys do a lot more of this stuff than I do!
Thanks.

Cliv

--
Message posted from http://www.ExcelForum.com

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
Activate Hyperlink in Named Range David Excel Worksheet Functions 2 May 8th 07 12:04 PM
Activate cell at end of range G Setting up and Configuration of Excel 2 November 22nd 05 04:10 PM
How to activate array formulas in a range of cells all at the same time? Karenna Excel Programming 3 February 29th 04 11:30 PM
Activate file without path location? Subscript out of range. Pal Excel Programming 3 February 29th 04 06:00 PM
range.activate Rune_Daub[_16_] Excel Programming 1 February 12th 04 06:55 PM


All times are GMT +1. The time now is 06:48 AM.

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"