Results 1 to 10 of 10

Need help with 2 different macros - Rows and Columns

Threaded View

  1. #1
    Registered User
    Join Date
    02-19-2015
    Location
    USA
    MS-Off Ver
    2010, 2013
    Posts
    5

    Need help with 2 different macros - Rows and Columns

    I have a workbook with several macros and I am stumped on two specific macros and would like to ask for some help.

    First One:

    I want to Hide All of the Rows (22:236) that do NOT have any data in columns B thru M. I have the following set up and it works for column B (B22:B236), but if I set a Range (B22:M236), it hides all of my rows. FYI, I have multiple header rows...I tried to attach some screen shots in a word doc, but it would not allow me to...just kept spinning. Anyways, Here is what I have:

    Sub HideRows_notused()
    '
    ' Hide_Rows
    '
    
    '
    For Each cell In Range("B22:B236")
        If (cell = "") Then cell.EntireRow.Hidden = True
    Next cell
    End Sub

    Second One:

    In the SAME workbook, I have several spreadsheets in which I want to hide the columns if the Data in a particular cell = 0. I have it working for one of the spreadsheets, just not sure how to make it happen on all at the same time. Here is what I have.

    Sub Hide_Columns_Notused()
        Application.ScreenUpdating = False
        Dim c As Range
        For Each c In Range("G3:M3")
            c.EntireColumn.Hidden = (c.Value = 0)
        Next c
        Application.ScreenUpdating = True
    End Sub
    The spreadsheets that I would like to hide on one button click are:

    1. Operating Budget - Based on G3:M3 being 0
    2. Travel Budget Details - Based on H8:N8 being 0
    3. Total Operating Budget - Based on D4:J4 being 0
    Last edited by Dragct; 02-20-2015 at 03:45 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] vb macros code to convert rows into columns one after other
    By Dharani Suresh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-11-2013, 05:30 AM
  2. [SOLVED] Macros for Moving Data from Columns to Rows
    By rrajnish in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-17-2013, 03:18 PM
  3. [SOLVED] Macros for Moving Data from Columns to Rows
    By rrajnish in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 06-17-2013, 03:15 PM
  4. Extended Range (Columns & Rows) in Macros
    By hardeep.kanwar in forum Excel General
    Replies: 0
    Last Post: 07-16-2009, 03:58 AM
  5. Macros deleting certain worksheets, columns and rows
    By Steezo in forum Excel General
    Replies: 0
    Last Post: 08-01-2005, 05:28 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1