Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
JMS JMS is offline
external usenet poster
 
Posts: 3
Default Recording Macros

I am using Excel 2003, with Windows XP Professional.

I have no prior knowledge of macros, so this may be a beginner problem.

I have a worksheet where I have dozens of groups of repeating rows.
I wanted to hide the same rows (non-contiguous rows) in every group.
So I recorded a macro, whereby I selected the non-contiguous rows for one of
the groups, then hid the rows.

Here is the VBA language from the recorded macro:


Range("187:187,189:189,192:192,199:199,200:200,202 :202,204:204,206:206,208:208" _
).Select
Range("A208").Activate
Selection.EntireRow.Hidden = True
End Sub

When I go to run this macro further down the same spreadsheet, it does not
do anything. I assumed, I could run it at any particular spot in the
spreadsheet, and it would hide the relative rows from my new starting point.

Any help would be appreciated.

Thanks,
Jamie
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Recording Macros

Per your macro, the numbers you see are those rows (And only those rows) that
will be hidden when your macro runs. In order to hide other rows you must
have an identifying criteria, and base your row hidding macro on that
criteria. Alternatively, you may want to use the Autofilter Method: Click on
the column where your filtering criteria is and From the main menu select
Data-Autofilter.
From the Dropdown box you can select custom and select criteria based on
predefined Excel functionality.

--
If this posting was helpful, please click on the Yes button.
Regards,

Michael Arch.




"JMS" wrote:

I am using Excel 2003, with Windows XP Professional.

I have no prior knowledge of macros, so this may be a beginner problem.

I have a worksheet where I have dozens of groups of repeating rows.
I wanted to hide the same rows (non-contiguous rows) in every group.
So I recorded a macro, whereby I selected the non-contiguous rows for one of
the groups, then hid the rows.

Here is the VBA language from the recorded macro:


Range("187:187,189:189,192:192,199:199,200:200,202 :202,204:204,206:206,208:208" _
).Select
Range("A208").Activate
Selection.EntireRow.Hidden = True
End Sub

When I go to run this macro further down the same spreadsheet, it does not
do anything. I assumed, I could run it at any particular spot in the
spreadsheet, and it would hide the relative rows from my new starting point.

Any help would be appreciated.

Thanks,
Jamie

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Recording Macros

The rows are fixed in the macro base on the numbers row 187, 189,192....

How can you tell when one group ends and the next group starts? I can write
a mcro that will run down the worksheet baed on the start and end of each
group.

"JMS" wrote:

I am using Excel 2003, with Windows XP Professional.

I have no prior knowledge of macros, so this may be a beginner problem.

I have a worksheet where I have dozens of groups of repeating rows.
I wanted to hide the same rows (non-contiguous rows) in every group.
So I recorded a macro, whereby I selected the non-contiguous rows for one of
the groups, then hid the rows.

Here is the VBA language from the recorded macro:


Range("187:187,189:189,192:192,199:199,200:200,202 :202,204:204,206:206,208:208" _
).Select
Range("A208").Activate
Selection.EntireRow.Hidden = True
End Sub

When I go to run this macro further down the same spreadsheet, it does not
do anything. I assumed, I could run it at any particular spot in the
spreadsheet, and it would hide the relative rows from my new starting point.

Any help would be appreciated.

Thanks,
Jamie

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Recording Macros

See if this helps

Public Sub Test()

Call HodeRows(187)
'etc.
End Sub

Sub HideRows(StartRow As Long)
Union(Rows(StartRow), Rows(StartRow + 2), Rows(StartRow + 5), _
Rows(StartRow + 12), Rows(StartRow + 13), Rows(StartRow + 15), _
Rows(StartRow + 17), Rows(StartRow + 19), Rows(StartRow +
21)).Hidden = True
End Sub


--
__________________________________
HTH

Bob

"JMS" wrote in message
...
I am using Excel 2003, with Windows XP Professional.

I have no prior knowledge of macros, so this may be a beginner problem.

I have a worksheet where I have dozens of groups of repeating rows.
I wanted to hide the same rows (non-contiguous rows) in every group.
So I recorded a macro, whereby I selected the non-contiguous rows for one
of
the groups, then hid the rows.

Here is the VBA language from the recorded macro:


Range("187:187,189:189,192:192,199:199,200:200,202 :202,204:204,206:206,208:208"
_
).Select
Range("A208").Activate
Selection.EntireRow.Hidden = True
End Sub

When I go to run this macro further down the same spreadsheet, it does not
do anything. I assumed, I could run it at any particular spot in the
spreadsheet, and it would hide the relative rows from my new starting
point.

Any help would be appreciated.

Thanks,
Jamie



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Recording Macros

ypo

Public Sub Test()

Call HideRows(187)
'etc.
End Sub


--
__________________________________
HTH

Bob

"Bob Phillips" wrote in message
...
See if this helps

Public Sub Test()

Call HodeRows(187)
'etc.
End Sub

Sub HideRows(StartRow As Long)
Union(Rows(StartRow), Rows(StartRow + 2), Rows(StartRow + 5), _
Rows(StartRow + 12), Rows(StartRow + 13), Rows(StartRow + 15), _
Rows(StartRow + 17), Rows(StartRow + 19), Rows(StartRow +
21)).Hidden = True
End Sub


--
__________________________________
HTH

Bob

"JMS" wrote in message
...
I am using Excel 2003, with Windows XP Professional.

I have no prior knowledge of macros, so this may be a beginner problem.

I have a worksheet where I have dozens of groups of repeating rows.
I wanted to hide the same rows (non-contiguous rows) in every group.
So I recorded a macro, whereby I selected the non-contiguous rows for one
of
the groups, then hid the rows.

Here is the VBA language from the recorded macro:


Range("187:187,189:189,192:192,199:199,200:200,202 :202,204:204,206:206,208:208"
_
).Select
Range("A208").Activate
Selection.EntireRow.Hidden = True
End Sub

When I go to run this macro further down the same spreadsheet, it does
not
do anything. I assumed, I could run it at any particular spot in the
spreadsheet, and it would hide the relative rows from my new starting
point.

Any help would be appreciated.

Thanks,
Jamie







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Recording macros Dricon1 Excel Discussion (Misc queries) 1 February 14th 07 03:42 PM
Training: More on how to use macros in Excel: Recording Macros ToriT Excel Worksheet Functions 2 February 10th 06 07:05 PM
How do I make the Stop Recording bar pop up when recording macros J Excel Worksheet Functions 1 January 10th 06 08:46 PM
Recording Macros Richard Excel Discussion (Misc queries) 1 August 16th 05 02:13 PM
recording macros Pat New Users to Excel 2 January 17th 05 03:33 PM


All times are GMT +1. The time now is 11:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"