Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Despite my limitation with writing codes, I need to find a simple to follow
code to hide rows without information in a specific column in three tables that I have on a single spreadsheet. The information on all these tables comes from another spreadsheet within the workbook hence upon changed to it, the information in my tables also changes. The table ranges are A67:I139, A171:I243 and A275-I347 They have the same number of rows but varying number of columns due to some merged columns. I want to hide rows that are blank in column 2 (in other words, display rows that are non-blank in column 2 in all the tables. Is this something that I can do with a code. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
One way:
option explicit sub testme01() dim myAddresses as variant dim myCell as range dim iCtr as long myAddresses = array("b67:b139","b171:b243","B275:b347") with worksheets("sheet99") for ictr = lbound(myaddresses) to ubound(myaddresses) for each mycell in .range(myaddresses(ictr)).cells mycell.entirerow.hidden = (mycell.value = "") next mycell next ictr end with end sub Chiku wrote: Despite my limitation with writing codes, I need to find a simple to follow code to hide rows without information in a specific column in three tables that I have on a single spreadsheet. The information on all these tables comes from another spreadsheet within the workbook hence upon changed to it, the information in my tables also changes. The table ranges are A67:I139, A171:I243 and A275-I347 They have the same number of rows but varying number of columns due to some merged columns. I want to hide rows that are blank in column 2 (in other words, display rows that are non-blank in column 2 in all the tables. Is this something that I can do with a code. -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Dave thanks for the code, do you mind telling me what it says - I apologize
that my knowledge of codes is limited, but once I am told what it means, I am able to follow and troubleshoot any problems I might have. "Dave Peterson" wrote: One way: option explicit sub testme01() dim myAddresses as variant dim myCell as range dim iCtr as long myAddresses = array("b67:b139","b171:b243","B275:b347") with worksheets("sheet99") for ictr = lbound(myaddresses) to ubound(myaddresses) for each mycell in .range(myaddresses(ictr)).cells mycell.entirerow.hidden = (mycell.value = "") next mycell next ictr end with end sub Chiku wrote: Despite my limitation with writing codes, I need to find a simple to follow code to hide rows without information in a specific column in three tables that I have on a single spreadsheet. The information on all these tables comes from another spreadsheet within the workbook hence upon changed to it, the information in my tables also changes. The table ranges are A67:I139, A171:I243 and A275-I347 They have the same number of rows but varying number of columns due to some merged columns. I want to hide rows that are blank in column 2 (in other words, display rows that are non-blank in column 2 in all the tables. Is this something that I can do with a code. -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
It looks through each cell in each of those ranges. Then if that cell is "", it
hides the row. (mycell.value = "") will evaluate to true or false depending on what's in that cell. Chiku wrote: Dave thanks for the code, do you mind telling me what it says - I apologize that my knowledge of codes is limited, but once I am told what it means, I am able to follow and troubleshoot any problems I might have. "Dave Peterson" wrote: One way: option explicit sub testme01() dim myAddresses as variant dim myCell as range dim iCtr as long myAddresses = array("b67:b139","b171:b243","B275:b347") with worksheets("sheet99") for ictr = lbound(myaddresses) to ubound(myaddresses) for each mycell in .range(myaddresses(ictr)).cells mycell.entirerow.hidden = (mycell.value = "") next mycell next ictr end with end sub Chiku wrote: Despite my limitation with writing codes, I need to find a simple to follow code to hide rows without information in a specific column in three tables that I have on a single spreadsheet. The information on all these tables comes from another spreadsheet within the workbook hence upon changed to it, the information in my tables also changes. The table ranges are A67:I139, A171:I243 and A275-I347 They have the same number of rows but varying number of columns due to some merged columns. I want to hide rows that are blank in column 2 (in other words, display rows that are non-blank in column 2 in all the tables. Is this something that I can do with a code. -- Dave Peterson -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I copied the code as is, and when I ran it, I got a subscription out of range
error. How do I fix that? Does it make any difference that one of the tables has a merged column B & C? "Dave Peterson" wrote: It looks through each cell in each of those ranges. Then if that cell is "", it hides the row. (mycell.value = "") will evaluate to true or false depending on what's in that cell. Chiku wrote: Dave thanks for the code, do you mind telling me what it says - I apologize that my knowledge of codes is limited, but once I am told what it means, I am able to follow and troubleshoot any problems I might have. "Dave Peterson" wrote: One way: option explicit sub testme01() dim myAddresses as variant dim myCell as range dim iCtr as long myAddresses = array("b67:b139","b171:b243","B275:b347") with worksheets("sheet99") for ictr = lbound(myaddresses) to ubound(myaddresses) for each mycell in .range(myaddresses(ictr)).cells mycell.entirerow.hidden = (mycell.value = "") next mycell next ictr end with end sub Chiku wrote: Despite my limitation with writing codes, I need to find a simple to follow code to hide rows without information in a specific column in three tables that I have on a single spreadsheet. The information on all these tables comes from another spreadsheet within the workbook hence upon changed to it, the information in my tables also changes. The table ranges are A67:I139, A171:I243 and A275-I347 They have the same number of rows but varying number of columns due to some merged columns. I want to hide rows that are blank in column 2 (in other words, display rows that are non-blank in column 2 in all the tables. Is this something that I can do with a code. -- Dave Peterson -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I'm guessing that the error occurs on this line:
with worksheets("sheet99") Change Sheet99 to the correct name. Chiku wrote: I copied the code as is, and when I ran it, I got a subscription out of range error. How do I fix that? Does it make any difference that one of the tables has a merged column B & C? "Dave Peterson" wrote: It looks through each cell in each of those ranges. Then if that cell is "", it hides the row. (mycell.value = "") will evaluate to true or false depending on what's in that cell. Chiku wrote: Dave thanks for the code, do you mind telling me what it says - I apologize that my knowledge of codes is limited, but once I am told what it means, I am able to follow and troubleshoot any problems I might have. "Dave Peterson" wrote: One way: option explicit sub testme01() dim myAddresses as variant dim myCell as range dim iCtr as long myAddresses = array("b67:b139","b171:b243","B275:b347") with worksheets("sheet99") for ictr = lbound(myaddresses) to ubound(myaddresses) for each mycell in .range(myaddresses(ictr)).cells mycell.entirerow.hidden = (mycell.value = "") next mycell next ictr end with end sub Chiku wrote: Despite my limitation with writing codes, I need to find a simple to follow code to hide rows without information in a specific column in three tables that I have on a single spreadsheet. The information on all these tables comes from another spreadsheet within the workbook hence upon changed to it, the information in my tables also changes. The table ranges are A67:I139, A171:I243 and A275-I347 They have the same number of rows but varying number of columns due to some merged columns. I want to hide rows that are blank in column 2 (in other words, display rows that are non-blank in column 2 in all the tables. Is this something that I can do with a code. -- Dave Peterson -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can I transpose rows to columns in a large worksheet? | Excel Discussion (Misc queries) | |||
What is fastest for this? The Small VBA or many Worksheet Functions...? | Excel Worksheet Functions | |||
Protect Worksheet but allow to insert or delete rows | Excel Discussion (Misc queries) | |||
Display specific rows from table on other worksheet | Excel Discussion (Misc queries) | |||
how to hide rows in a protected sheet | Excel Worksheet Functions |