Hi all,
I'm new here and I actually have 2 questions, but we will start with this one as this is the one that I've been trying to find an answer to longest.
I have a table that pulls data from another worksheet based on the date selected. I have made a quick chart to show the data in that table. My problem is my chart is showing the blank cells as well as those that have data. I need my chart to only show those cells that have data, but the table will update with the use of a drop down list. So, Nov 1, I may have 3 rows of data to show in my chart, but Nov 6 I only have 1. Since my knowledge of excel and vba are both minimal, I am hoping someone that knows what they are doing can help me.
Basically, what I am looking for is, if row 3 is blank in my table, then hide rows 3-16. But if the next day chosen I have data in rows 2-5, then only hide rows 6-16.
Not sure this makes sense or not.
Thank you for your help in this.
I did post on another forum, and got a vba code that worked in the file they uploaded for me. But when I tried to copy/paste the code into my own worksheet, it didn't work.
This is the code that was given to me....
When I copy and pasted, I changed the ranges from "N28" to "F1" and "I28" to "I1". I'm not sure if that's why it wouldn't work or if there is something else I am not doing.
I need this to run in the background as this sheet will eventually be hidden once my workbook is finished.
Sorry for the rambling, hope someone can help, and maybe explain what was done as well so I can learn.
I'm new here and I actually have 2 questions, but we will start with this one as this is the one that I've been trying to find an answer to longest.
I have a table that pulls data from another worksheet based on the date selected. I have made a quick chart to show the data in that table. My problem is my chart is showing the blank cells as well as those that have data. I need my chart to only show those cells that have data, but the table will update with the use of a drop down list. So, Nov 1, I may have 3 rows of data to show in my chart, but Nov 6 I only have 1. Since my knowledge of excel and vba are both minimal, I am hoping someone that knows what they are doing can help me.
Basically, what I am looking for is, if row 3 is blank in my table, then hide rows 3-16. But if the next day chosen I have data in rows 2-5, then only hide rows 6-16.
Not sure this makes sense or not.
Thank you for your help in this.
I did post on another forum, and got a vba code that worked in the file they uploaded for me. But when I tried to copy/paste the code into my own worksheet, it didn't work.
This is the code that was given to me....
VBA Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Const SelValAdd = "N28"
Const TabRefAdd = "I28"
Dim WkRg As Range, Rg As Range, HdRg As Range
If (Target.Address <> Range(SelValAdd).Address) Then Exit Sub
Set WkRg = Range(TabRefAdd).CurrentRegion
Application.ScreenUpdating = False
WkRg.EntireRow.Hidden = False
For Each Rg In WkRg.Columns(3).Cells
If (Len(Rg) = 0) Then
If (HdRg Is Nothing) Then
Set HdRg = Rg
Else
Set HdRg = Union(HdRg, Rg)
End If
End If
Next Rg
HdRg.EntireRow.Hidden = True
Application.ScreenUpdating = True
End Sub
When I copy and pasted, I changed the ranges from "N28" to "F1" and "I28" to "I1". I'm not sure if that's why it wouldn't work or if there is something else I am not doing.
I need this to run in the background as this sheet will eventually be hidden once my workbook is finished.
Sorry for the rambling, hope someone can help, and maybe explain what was done as well so I can learn.
Attachments
Last edited by a moderator: