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

"Konrad Viltersten" skrev i en meddelelse
...
I ran the following example from the Help.

Worksheets("Blad3").Range(Cells(1, 1), Cells(3, 2)).Font.Italic = True

To my astonishment i get an error - 1004. The description
is rather vague and i have no idea how to shoot down
this one. Any suggestions?

It should be said that the following code does work as
it's supposed to.

Worksheets("Blad3").Range("A1:B3").Font.Italic = True

Now, for a number of reasons i need to use the syntax
from the first Range-way. How can i do that?

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



Hej Konrad

Worksheets("Blad3") is probably different from the active sheet,
and Cells() (without a full stop) points to the active sheet.
To get it to work, you have to do something like this:

With Worksheets("Blad3")
.Range(.Cells(1,1),.Cells(3,2)).Font.Italic = True
End With


--
Venlig hilsen
Leo Heuser

Followup to newsgroup only please.