Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hello!
I need help with some macro coding, as I am new to it. Here is the basic breakdown: I have 50 rows of data space. Some rows do not have date. I need to hide the rows which don't have data. If I could code it by dictation, I would say "If A2 is empty, hide the row. Do the same for A3 through A50" Any suggestions?? |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi Catherine,
Try: '============= Public Sub Tester() Dim rng As Range Set rng = ActiveSheet.Range("A2:A50") '<<==== CHANGE On Error Resume Next rng.SpecialCells(xlBlanks).EntireRow.Delete On Error GoTo 0 End Sub '<<============= --- Regards, Norman "Catherine Bond" wrote in message ... Hello! I need help with some macro coding, as I am new to it. Here is the basic breakdown: I have 50 rows of data space. Some rows do not have date. I need to hide the rows which don't have data. If I could code it by dictation, I would say "If A2 is empty, hide the row. Do the same for A3 through A50" Any suggestions?? |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi Catherine,
As you are not familiar with macros, you may wish to visit David McRitchie's 'Getting Started With Macros And User Defined Functions' at: http://www.mvps.org/dmcritchie/excel/getstarted.htm You might also look at David's tutorials page at: http://www.mvps.org/dmcritchie/excel....htm#tutorials The VBA tutorial information is towards the end of that section. --- Regards, Norman |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi Catherine,
rng.SpecialCells(xlBlanks).EntireRow.Delete Should read: rng.SpecialCells(xlBlanks).EntireRow.Hidden = True The first (erroneously) deletes the blank rows; the second hides these rows, as you requested! --- Regards, Norman "Norman Jones" wrote in message ... Hi Catherine, Try: '============= Public Sub Tester() Dim rng As Range Set rng = ActiveSheet.Range("A2:A50") '<<==== CHANGE On Error Resume Next rng.SpecialCells(xlBlanks).EntireRow.Delete On Error GoTo 0 End Sub '<<============= --- Regards, Norman |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
One way:
Sub HideRows() Dim i As Long Application.ScreenUpdating = False For i = 2 To 50 If Range("A" & i).Value = "" Then Range("A" & i).EntireRow.Hidden = True End If Next 'i Application.ScreenUpdating = True End Sub Regards Trevor "Catherine Bond" wrote in message ... Hello! I need help with some macro coding, as I am new to it. Here is the basic breakdown: I have 50 rows of data space. Some rows do not have date. I need to hide the rows which don't have data. If I could code it by dictation, I would say "If A2 is empty, hide the row. Do the same for A3 through A50" Any suggestions?? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to: Find a Reference, and then Paste into the 10 Rows Below | Excel Discussion (Misc queries) | |||
macro or code to open multiple workbooks | Excel Discussion (Misc queries) | |||
How to see macro code of a password protected macro without a password? | Excel Worksheet Functions | |||
Macro as multiple use code | New Users to Excel | |||
Make Change Case in Excel a format rather than formula | Excel Worksheet Functions |