Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2004
    Posts
    21

    Unanswered: Adding code into macro

    Hi there

    I need some help. I got a sub procedure given to me by DavidCoutts(see below). I need to put this sub procedure somewhere halfway inside a macro that I have created.But I am not sure what are the lines of code I should write inside this macro to activate this sub procedure.Pls help.Thanks


    Sub Test()
    Dim Lastrow As Double
    Dim I As Integer, J As Integer

    'Gets Lastrow of Data assuming that column A is Completely Filled
    Lastrow = Range("A" & Rows.Count).End(xlUp).Row

    'Clear the Corresponding Data(O to Y every Second Column)
    For I = 15 To 25 Step 2
    With Range(Cells(2, I), Cells(Lastrow, I)).SpecialCells(xlCellTypeBlanks)
    .Offset(0, -1).Clear
    For J = 1 To (11 - I + 15) 'Counts the Columns to Y
    .Offset(0, J).Clear
    Next J
    End With
    Next I
    End Sub

  2. #2
    Join Date
    Mar 2004
    Location
    Fort Worth, Texas, USA
    Posts
    68
    davidkoh79,

    Are you still there? Did you solve your problem?

    No answers to a post usually means one of three things:

    1) Over-the-top complexity that dumbfounds all of us.

    2) Suspicion that poster is freeloading, trying to get others to do his/her job or schoolwork.

    3) All potential responders are too polite to say RTFM

    So the answer to getting help on this forum is: work your tail off to solve your problem, and if you're still puzzled, post your efforts here. Obvious frustration is almost always quickly responded to.

    Good Luck

  3. #3
    Join Date
    Feb 2004
    Posts
    21

    Reply to actuary

    Hi there

    Yes I am still here. I am still trying to figure out how to use VB.I am extremely new to this programming language.I am working my tail off to solve my problem and I am still puzzled, that is why i post my effort here in this forum.I am not a freeloader,asking people to do my job!Anyway,thanks for your concern

    David

  4. #4
    Join Date
    Mar 2004
    Location
    Fort Worth, Texas, USA
    Posts
    68
    OK, I was harsh. I'm betting what you're looking for is

    Call Test

    'this will run the Test Sub in the middle of your macro

    Something else that would help you a lot is reviewing the code in SAMPLES.XLS (found in your ...\Office\Samples folder)

  5. #5
    Join Date
    Feb 2004
    Posts
    21

    Thanks

    Hi actuary

    Thanks.The line of code works.Anyway,I was looking into microsoft excel help.They were saying that I just need to type the name of the sub procedure example just type in Test instead of call Test.and it also works.
    Thanks anyway.

Posting Permissions

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