+ Reply to Thread
Results 1 to 4 of 4

Multiple Commands

Hybrid View

  1. #1
    Registered User
    Join Date
    10-10-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    34

    Multiple Commands

    Hi, I have these formulas below which go on from rows 4 up to row 1900. The file is huge and lags forever.

    I believe if a VBA code is used the file size could be reduced a little bit. These are the formulas I want to convert to a VBA code instead.

    =IF(M4="","",IF(M4="Open",1,""))

    =IF(Q4="","",IF(Q4="LATE",1,""))

    =IF(Q4="","",IF(Q4="TIMELY",1,""))

    =IF(K4="","",1)

    =IF(P4="","",(IF(P4<=O4,"TIMELY","LATE")))

    =IF(G4="","",G4+(7-WEEKDAY(G4)))

    Next question is how to combine the new codes with this code I have below.


    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    
    
    If Cells(3, Target.Column) = "Name" And Target <> "" Then
        Target.Offset(0, 254 - Target.Column + 2).Value = Int(Now)
    End If
    
    If Cells(3, Target.Column) = "Name" And Target = "" Then
        Target.Offset(0, 254 - Target.Column + 2).ClearContents
    End If
    
    End Sub
    I appreciate any help I can get.

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Multiple Commands

    Hi jpxexcelforum

    You would do best to post a sample workbook showing your Sheet Layout and perhaps Before and After examples.

    It should clearly illustrate your problem and not contain any sensitive data.

    Cheers

    From Forum FAQs

    How do I attach a file to a post?

    To attach a file to your post, you need to be using the main 'New Post' or 'New Thread' page and not 'Quick Reply'. To use the main 'New Post' page, click the 'Post Reply' button in the relevant thread.

    On this page, below the message box, you will find a button labelled 'Manage Attachments'. Clicking this button will open a new window for uploading attachments. You can upload an attachment either from your computer or from another URL by using the appropriate box on this page. Alternatively you can click the Attachment Icon to open this page.

    To upload a file from your computer, click the 'Browse' button and locate the file. To upload a file from another URL, enter the full URL for the file in the second box on this page. Once you have completed one of the boxes, click 'Upload'.

    Once the upload is completed the file name will appear below the input boxes in this window. You can then close the window to return to the new post screen.

  3. #3
    Registered User
    Join Date
    10-10-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    34

    Re: Multiple Commands

    Great idea! Thanks.

    Here's an attachment. The formulas are in column I,M,N,O and from T to Z. I haven't finished with the file yet I plan to add more formulas.

    The conversion of the formula in the columns I mentioned would be a great. I zipped the file because it was too big.
    Attached Files Attached Files

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Multiple Commands

    I really don't see why what you are doing would cause the file to lag.
    1900 rows is certainly not huge.

    Why do you want to insert the date in the last column in the sheet?

    I would suggest that the code you are trying to build should be in the sheet module for Sheet "Raw" not the workbook module.
    Maybe something on these lines
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Target.Column = 18 And Target.Row > 3 Then
            If Target <> "" Then
                Cells(Target.Row, 256) = Date
            Else
                Cells(Target.Row, 256).Clear
            End If
        End If
    End Sub
    I don't know where all of your formulae reside, but of the ones I can see, some could be reduced a bit, but this will do nothing to improve speed, and using VBA to apply these conditions will if anything slow this up.
    e.g.
    In U4
    =IF(Q4="TIMELY",1,"")
    is the same as
    =IF(Q4="","",IF(Q4="TIMELY",1,""))
    What else are you doing that might slow up the workbook?
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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