Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Hiding entire row(s) on entering data in cell(s)

Suppose I have some data in filtered columns which are labeled except one
column 'salary'. My question is:

Is it possible to hide the entire row(s) of 'salary' column one by one
automatically on entering data in cell(s).

There must be a way to accomplish this via vba but I am novice in writing
code.

Your help is requested.

Regards.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Hiding entire row(s) on entering data in cell(s)

Hi Shabutt,

Probably need a little more information but here goes my first attempt.

Do I understand correctly that the Salary column has blank cells where the
data is to be entered? If so, is there any reason that the salary column
filter cannot be set to blanks?

If the salary column can be set to blanks then it is possible to force
refiltering each time a change is made to the Salary column.

Just right click on the sheet name tab and select View Code and copy and
paste the following macro into the VBA editor. You will need to edit the code
to insert the correct column number and also the correct filter number.

To get the correct filter number and code, turn on the macro recorder and
set the salary filter to blanks and then turn off the recorder and you will
have the required line of code. (It will be in Module1 of the VBA editor.
Copy just the line of code from there to replace the filter setting line of
code in the sheet module where you place the following macro.)

Private Sub Worksheet_Change(ByVal Target As Range)

'Edit as per instructions above. (change column 6 to your Salary column
number)
If Target.Column = 6 Then
Selection.AutoFilter Field:=6, Criteria1:="="
End If

End Sub

--
Regards,

OssieMac


"shabutt" wrote:

Suppose I have some data in filtered columns which are labeled except one
column 'salary'. My question is:

Is it possible to hide the entire row(s) of 'salary' column one by one
automatically on entering data in cell(s).

There must be a way to accomplish this via vba but I am novice in writing
code.

Your help is requested.

Regards.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Hiding entire row(s) on entering data in cell(s)

Hi,

Thank you very much for quick reply. "OssieMac" your code works like a charm
and it's so simple to understand as well. I am really grateful.

Regards.

"OssieMac" wrote:

Hi Shabutt,

Probably need a little more information but here goes my first attempt.

Do I understand correctly that the Salary column has blank cells where the
data is to be entered? If so, is there any reason that the salary column
filter cannot be set to blanks?

If the salary column can be set to blanks then it is possible to force
refiltering each time a change is made to the Salary column.

Just right click on the sheet name tab and select View Code and copy and
paste the following macro into the VBA editor. You will need to edit the code
to insert the correct column number and also the correct filter number.

To get the correct filter number and code, turn on the macro recorder and
set the salary filter to blanks and then turn off the recorder and you will
have the required line of code. (It will be in Module1 of the VBA editor.
Copy just the line of code from there to replace the filter setting line of
code in the sheet module where you place the following macro.)

Private Sub Worksheet_Change(ByVal Target As Range)

'Edit as per instructions above. (change column 6 to your Salary column
number)
If Target.Column = 6 Then
Selection.AutoFilter Field:=6, Criteria1:="="
End If

End Sub

--
Regards,

OssieMac


"shabutt" wrote:

Suppose I have some data in filtered columns which are labeled except one
column 'salary'. My question is:

Is it possible to hide the entire row(s) of 'salary' column one by one
automatically on entering data in cell(s).

There must be a way to accomplish this via vba but I am novice in writing
code.

Your help is requested.

Regards.

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
Move entire row of data from open to closed file by entering date TB[_2_] Excel Discussion (Misc queries) 0 May 12th 08 10:07 PM
When entering data into a range of cells, select the entire range. Q Excel Discussion (Misc queries) 0 September 26th 07 04:36 AM
Hiding entire rows Steve Excel Programming 2 August 9th 07 04:22 AM
"Highlight" Entire Row while entering data lightspeed Excel Programming 6 August 10th 06 09:26 PM
Conditional hiding of entire rows Nick Turner Excel Worksheet Functions 4 January 2nd 06 11:09 PM


All times are GMT +1. The time now is 06:04 PM.

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

About Us

"It's about Microsoft Excel"