Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can change range to select active rows instead of :=Range("S10 | Excel Discussion (Misc queries) | |||
Find End in Undefined Range Select Range Trim | Excel Programming | |||
When entering data into a range of cells, select the entire range. | Excel Discussion (Misc queries) | |||
Compare a selected Range with a Named range and select cells that do not exist | Excel Programming | |||
Select Sheet then Select Range | Excel Programming |