• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Auto hide empty rows for a different sheet, same workbook

Hema1309

New Member
Hello everyone,

I am a newbie to vba code and have created multiple sheets for a work purpose. I am struggling with one portion of it. I need to automatically hide empty rows on a different sheet (same workbook).
The code I am using is giving me syntax error back and I cant seem to figure it out. Any help is highly appreciated!


Thanks,
Hema
 

Attachments

  • Application.docx
    11.8 KB · Views: 1
Hi ,

Please upload a workbook , and explain what you want done.

Asking members to debug your code is always more problematic , because for one , not everyone wants to go through someone else's code.

Narayan
 
Thank you for your respond Narayan.

The workbook is attached is it massive!

The code that I am having issue with is I have created this code on PDData sheet and it needs to hide empty rows in FlatStage sheet.

Code:
Application.ScreenUpdating = False

Dim s As String

For i = 1 To worksheet("FlatStage”).range("A7:A32").AutoFilter 1, "<>", , , False

  s = i & ":" & i

  If IsEmpty(Cells(i, 1).Value) Then

  Rows(s).Select

  Selection.EntireRow.Hidden = True

  End If

  Application.ScreenUpdating = False
 

Attachments

  • Trial with changes5.xlsm
    867.5 KB · Views: 3
Hi ,

As Excel workbooks go , this is not massive ; thanks for uploading the workbook and the explanation.

Can you check back after a couple of hours ?

Narayan
 
Thank you for your respond Narayan.

The workbook is attached is it massive!

The code that I am having issue with is I have created this code on PDData sheet and it needs to hide empty rows in FlatStage sheet.

Code:
Application.ScreenUpdating = False

Dim s As String

For i = 1 To worksheet("FlatStage”).range("A7:A32").AutoFilter 1, "<>", , , False

  s = i & ":" & i

  If IsEmpty(Cells(i, 1).Value) Then

  Rows(s).Select

  Selection.EntireRow.Hidden = True

  End If

  Application.ScreenUpdating = False
Hi ,

As Excel workbooks go , this is not massive ; thanks for uploading the workbook and the explanation.

Can you check back after a couple of hours ?

Narayan
I sure can, it is way past my bedtime but I am sure to be up early to check it. The workbook contains more, I am newbie so if you see anything silly, please ignore it! Again, thank you so much!
 
Hi ,

I could not see any problem in the code ; did you mean the Worksheet_Change procedure ?

Can you check the attached workbook and clarify / confirm ?

Narayan
 

Attachments

  • Trial with changes5.xlsm
    874.4 KB · Views: 3
This snippet I think is what your snippet in msg#3 is trying to do:
Code:
Application.ScreenUpdating = False
For Each cll In Sheets("FlatStage").Range("A7:A32").Cells
  cll.EntireRow.Hidden = (Len(cll.Value) = 0)
Next cll
Application.ScreenUpdating = False
 
Hi ,

I could not see any problem in the code ; did you mean the Worksheet_Change procedure ?

Can you check the attached workbook and clarify / confirm ?

Narayan
Narayan,

What I am trying to do is to hide the empty rows in FlatStage A7:A32 when those rows are empty and when it is not, it needs to display the data. The workbook you sent back to me doesn't seem to be able to do that.
Yes I meant the Worksheet_Change procedure :)
 
Hi ,

What about the other lines of code in the existing Worksheet_Change procedure ? Should they remain ?

I was confused because the existing Worksheet_Change procedure does not have the lines of code you posted.

Narayan
 
This snippet I think is what your snippet in msg#3 is trying to do:
Code:
Application.ScreenUpdating = False
For Each cll In Sheets("FlatStage").Range("A7:A32").Cells
  cll.EntireRow.Hidden = (Len(cll.Value) = 0)
Next cll
Application.ScreenUpdating = False
Hi ,

What about the other lines of code in the existing Worksheet_Change procedure ? Should they remain ?

I was confused because the existing Worksheet_Change procedure does not have the lines of code you posted.

Narayan
Narayan,

The other lines needs to remain, the code that is not working is on the very last section on PDData sheet.
 
Thank you so much Narayan. One portion of your code worked for me and I derived the rest for the sheets. - A little slow, but better than nothing!

Thank you again!
The code I landed up using is :
Code:
Application.ScreenUpdating = False
  For Each c In Worksheets("FlatStage").Range("A7:A32")
  If c.Value = "" Then
  c.EntireRow.Hidden = True
  Else
  c.EntireRow.Hidden = False
  End If
 
Back
Top