Results 1 to 20 of 20

How to simplify this macro

Threaded View

  1. #1
    Registered User
    Join Date
    12-04-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    91

    How to simplify this macro

    Friends,
    Can you help me to simplify this code.
    this one taking much time to process. The current date will be in the 7th row. and there is another macro is already there to hide columns except today date's one. Also this code has got from a post of mine on this forum only. Hope I am not violating the forum rules. Friends, Kindly help me with this. :-)

    Private Sub Button506_Click()
    
        Dim BeginCol As Long
        Dim endCol As Long
        Dim ChkRow As Long
        Dim Colcnt
        Dim rng As Range
        Dim c As Variant
    
        Application.ScreenUpdating = False
        BeginCol = 6
        endCol = 37
        ChkRow = 7
        For Colcnt = BeginCol To endCol
            Sheets("Sheet1").Cells(ChkRow, Colcnt).Select
            If Sheets("Sheet1").Cells(ChkRow, Colcnt).Value = Date Then
                Set rng = Sheets("Sheet1").Cells(ChkRow, Colcnt).Rows("2:500")
                For Each c In rng
                    If Sheets("Sheet1").Cells(c.Row, 2).Value <> "" Then
                        If c.Value = 0 Then
                            c.Value = "P"
                        End If
                    End If
                Next c
            Else
                'Sheets("Sheet1").Cells(ChkRow, Colcnt).EntireColumn.Hidden = True
            End If
        Next Colcnt
        
        Application.ScreenUpdating = True
        
    End Sub
    Last edited by aneshdas; 01-13-2014 at 03:49 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to simplify Macro IF function
    By herukuncahyono in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-19-2013, 04:31 AM
  2. I need macro/ vba help to simplify a report
    By sjoseph in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-02-2013, 03:30 PM
  3. Simplify macro
    By iamasimpleman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-29-2011, 07:01 AM
  4. How do I simplify this macro?
    By snooze24 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-20-2009, 04:47 PM
  5. Simplify a macro
    By Einar in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-23-2005, 05:05 AM

Tags for this Thread

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