View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Recorded macro selection widened

Merged cells react differently in different versions of excel.

To make matters worse, merged cells react differently in code than in the user
interface (as you've seen).

I do my best not to use merged cells.



Walter Briscoe wrote:

I am running Excel 2003.

I have data which looks like this

A B C D E F G
1 Title on all columns
2 A2 B2 C2 D2 E2 F2 G2
3 A3 B3 C3 D3 E3 F3 G3
4 A4 B4 C4 D4 E4 F4 G3
5 A5 B5 C5 D5 E5 F5 G4
6 A6 B6 C6 D6 E6 F6 G6
...

I record a macro which hides row 1 and selects column C.
When I step through the code, the whole sheet seems to be selected.
I have a workaround; I would like an explanation.

Rows("1:1").EntireRow.Hidden = True ' Hide first row
Columns("C:C").Select ' "selects" Columns("A:G")
Range("C2", Range("C2").End(xlDown)).Select ' "selects" what I want.

--
Walter Briscoe


--

Dave Peterson