LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default select range...

Not your fault. This is a common error.
--
Gary''s Student - gsnu200769


"Hemant_india" wrote:

thanks
must get it in my head
sort of out of touch i guess
--
hemu


"Gary''s Student" wrote:

Make sure that worksheets(1) has been activated before trying to Select a
range on that worksheet. This code:

Sub ThisCanFail()
Dim r As Range
Set r = Worksheets(1).UsedRange
MsgBox (r.Address)
r.Select
End Sub

will definitely generate an error if it is run with a different worksheet
being active.
--
Gary''s Student - gsnu200769


"Hemant_india" wrote:

hi guys
what's wrong with the following coe?
i am all gone mad

Dim rnghead As Range
Dim head1()
Set rnghead = Worksheets(1).UsedRange
ReDim head1(1 To rnghead.Columns.Count)
For n = 1 To rnghead.Columns.Count
head1(n) = rnghead.Cells(1, n)
Next n
With ActiveSheet
For n = 1 To rnghead.Columns.Count
'rnghead.Cells(1, n).Select ''error select range method fails'

rnghead.Cells(1, n).Interior.ColorIndex = 10
next
end with

please ...
--
hemu

 
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
How can change range to select active rows instead of :=Range("S10 ldiaz Excel Discussion (Misc queries) 7 August 29th 08 03:52 PM
Find End in Undefined Range Select Range Trim SteveT Excel Programming 4 November 29th 07 06:54 PM
When entering data into a range of cells, select the entire range. Q Excel Discussion (Misc queries) 0 September 26th 07 04:36 AM
Compare a selected Range with a Named range and select cells that do not exist PCLIVE Excel Programming 1 October 18th 05 07:09 PM
Select Sheet then Select Range Gee[_2_] Excel Programming 3 May 27th 04 10:10 PM


All times are GMT +1. The time now is 01:45 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"