Re: Can't get VBA to work without select
- From: "Jon Peltier" <jonxlmvpNO@xxxxxxxxxxxxxxxxxxx>
- Date: Tue, 5 Feb 2008 07:30:57 -0500
Not if a chart *** was the active ***. And it would give you the last
filled cell in column A of the active sheet, not Worksheets(1).
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______
"Bob Phillips" <bob.NGs@xxxxxxxxxxxxx> wrote in message
news:uBI4jOoZIHA.4284@xxxxxxxxxxxxxxxxxxxxxxx
If you had used Rows.Count, you would have gotten away with it (but you
sould properly qualify it
Sub BoldCells()
Dim r As Range
Dim i As Range
Set r = Worksheets(1).Range("A1", Range("A" & Rows.Count).End(xlUp))
For Each i In r
i.Font.Bold = Not i.Font.Bold
Next i
End Sub
--
---
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my
addy)
"D." <davesexcel@xxxxxxxxx> wrote in message
news:890d5c7e-c579-4c4f-bc4c-bf3a85d07a26@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have this code that works fine only if I am on work***(1),
If I am on another *** it does not work I get runtime error 1004
Here it is
#Sub BoldCells()
Dim r As Range
Dim i As Range
Set r = Worksheets(1).Range("A1", Range("A65536").End(xlUp))
For Each i In r
i.Font.Bold = Not i.Font.Bold
Next i
End Sub#
What am I missing, so the code will work without having to select the
***?
Thanks
.
- References:
- Can't get VBA to work without select
- From: D.
- Re: Can't get VBA to work without select
- From: Bob Phillips
- Can't get VBA to work without select
- Prev by Date: Re: What icon in Excel 2007 does the pattern shading?
- Next by Date: RE: run-time error 13: Type mismatch?
- Previous by thread: Re: Can't get VBA to work without select
- Next by thread: Re: Can't get VBA to work without select
- Index(es):