View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Konrad Viltersten Konrad Viltersten is offline
external usenet poster
 
Posts: 26
Default Strange range behavior (example from Help doesn't work)

Hi Konrad,
Where is your code placed?



I don't know how to answer this, mostly because of my
ignorance. What i can tell you is how i went about to
put in the code, maybe that will shed some light...

In Excel i go for Tools - Macro - VB Editor. In there
i simply put in those line of code.

Public Sub Test2()
Dim rSelected As Range
Set rSelected = Selection
'rSelected.Cells(1, 1).Font.Italic = True
With Worksheets("Blad3").Range(Cells(1, 1), Cells(3, 2)).Font.Italic = True
End With
'Worksheets("Blad3").Range("A1:B3").Font.Italic = True
End Sub

While the (for now) commented rows do work rather
well, the Range(Cells,Cells) performs badly, resulting
in the error described.

What can be done to kill it?

--
Vänligen
Konrad
---------------------------------------------------

Sleep - thing used by ineffective people
as a substitute for coffee

Ambition - a poor excuse for not having
enough sence to be lazy
---------------------------------------------------