Consulting

Page 3 of 3 FirstFirst 1 2 3
Results 41 to 49 of 49

Thread: VB Code help on Worksheets

  1. #41
    VBAX Regular
    Joined
    May 2012
    Posts
    64
    Location
    Yes, once the user will be on the "Contract" sheet, the Comment will become useless as all contracts will be ready.

    It would be nice to have a code that when the user will add a number in Cell B (Example 003) that the "comment" column clears the content and the user will be able to insert a new comments.

    The way I modified the "lookup" the code will now search for the contract number and not the requisition number...

    ...

    One more thing:

    I don't quiet get why the formulas in the previous pages do not clear when the "yes" function is activated?

    If you do the test on Sheet1 sheet2, the formula stays in the cell? But i looked at my functions, and it clears the content from columns A to the column that has the "yes" inserted in.

    what am I missing?

  2. #42
    VBAX Expert Tinbendr's Avatar
    Joined
    Jun 2005
    Location
    North Central Mississippi (The Pines)
    Posts
    993
    Location
    Quote Originally Posted by VNouBA
    It would be nice to have a code that when the user will add a number in Cell B (Example 003) that the "comment" column clears the content and the user will be able to insert a new comments.
    Can you do this when the number of contracts are entered? Would the process be far enough along to remove the comments?

    I don't quiet get why the formulas in the previous pages do not clear when the "yes" function is activated?
    Hmm. don't know. I can't replicate this.

    I'm using [vba]Application.EnableEvents = False[/vba] at the beginning of the Sub, and True at the end to prevent the recursive calling of the Change Event until the code has finished changing everything.

    David


  3. #43
    VBAX Regular
    Joined
    May 2012
    Posts
    64
    Location
    Quote Originally Posted by Tinbendr
    Can you do this when the number of contracts are entered? Would the process be far enough along to remove the comments?
    Yes the process of the comments from sheet 1,2 and 3 will be for managements only. They will be able to see where is the files are and why. Once the contracts has been awarded, then, the comments will become useless. When the contracts are awarded the comments are user to add comments for the deliveries. Each contracts will have it's own comments if needed.

    So to delete the previous comments from adding information from Column B would be perfect cause now the file number will become "Kind of" useless.

    If "B" equal number/information then also Clear Column "R" from Sheet5 "Report" of that same row. But to keep the code from the main function. If "B" equal number/information then add rows...

    Then with the upper code I modified from your "Lookup" code... It would add the comment from "M" sheet4 to the "Report" sheet in Column "R"

  4. #44
    VBAX Regular
    Joined
    May 2012
    Posts
    64
    Location
    What we could do is the following but my transfer code in my "Contracts" sheet is not working anymore. I will also add my latest Workbook.

    We keep the transfer of the comments. When the user is to the point of the contracts issuing, then the comment in the “Report” could be deleted and info can be inserted on top of it.

    The problem I am having is the transferring of the information from the “Contracts” sheet going on the same row of the project number on the “Report” sheet so that column “B” from the “Contracts” sheet copies and paste automatically the info on the “Report” sheet in Column “J”

    I’m trying to play around with the codes but nothing…

    I changed the Vlookup to look for the contract number instead of the project number. Plus I have some offset in my "Report" sheet that will automatically add the original file number to the other added rows in Column "A"

    Let me know if you could help
    Attached Files Attached Files

  5. #45
    VBAX Expert Tinbendr's Avatar
    Joined
    Jun 2005
    Location
    North Central Mississippi (The Pines)
    Posts
    993
    Location
    Just time for a quick look.

    A couple/three things.

    1. You have declared TCol, but you haven't defined it.
    [vba]TCol = Target.Column[/vba]
    2. You're testing these values against TCol AND TRow? See #3.
    [vba] If TCol > 4 Or TCol < 19 Then
    If TRow > 4 Or TRow < 19 Then
    [/vba]
    3. And about half way down, you testing it again, even though you're inside the test already.
    [vba] If TCol > 4 Or TCol < 19 Then
    'If yes is inserted in Column N the following will...
    If Not Intersect(Target, Range("N:N")) Is Nothing Then[/vba]

    David


  6. #46
    VBAX Regular
    Joined
    May 2012
    Posts
    64
    Location
    I think this is the last tweeks:

    When doing the following in "MERX" the code doesn't clear. Dont know why...

    [VBA]
    If Target.Column = 1 Then
    Cells(Target.Row, "D").FormulaR1C1 = "=IF(RC3="""","""",RC3+90)"
    End If
    [/VBA]

    When:

    [VBA]
    Range(Cells(Target.Row, 1), Cells(Target.Row, 6)).ClearContents
    [/VBA]

    Column D doesn't clear, the code still stays...

    After this everything looks A ok Even the "Contracts" sheet
    Attached Files Attached Files

  7. #47
    VBAX Regular
    Joined
    May 2012
    Posts
    64
    Location
    Another little thing would be on the "Contracts" sheet.

    If info is in row 5, 6 and 8, therefore information is cleared on 7, when I select yes from the "Evaluation" sheet the info will add itself to Row 9...

    Same thing happends on Sheet "Contracts" going to "Report"

    Should be Next available row from row 5...

    Actually it does this too all the sheets

  8. #48
    VBAX Regular
    Joined
    May 2012
    Posts
    64
    Location

    Unhappy

    I think this workbook is almost completed...
    I have cleaned up each sheets.

    I need to know one more little detail:

    In the "Contracts" sheet... where would I add

    [VBA]
    Application.EnableEvents = False
    [/VBA]
    and
    [VBA]
    Application.EnableEvents = True
    [/VBA]

    To not have it search or loop when I insert 001 in Column "B"

    When 002 or higher is inserted it doesnt "Stall" but 001 will kinda glitch before inserting the info...
    Attached Files Attached Files

  9. #49
    VBAX Expert Tinbendr's Avatar
    Joined
    Jun 2005
    Location
    North Central Mississippi (The Pines)
    Posts
    993
    Location
    Quote Originally Posted by VNouBA
    In the "Contracts" sheet... where would I add
    [vba]Application.EnableEvents = False
    [/vba] Just after the Dims[vba]
    Application.EnableEvents = True[/vba]
    Just before the Exit Sub.

    BTW, if you're working with the code and stop it before the True, you'll have to enter the True in the immediate window to get the exit routine working again.

    To not have it search or loop when I insert 001 in Column "B"
    [vba] NumRows = Target.Value - 1
    For R = 1 To NumRows
    Target.Offset(1, 0).EntireRow.Insert
    [/vba] I could not replicate this. This code is preventing that because when NumRows is 0, the loop never runs.


    When 002 or higher is inserted it doesnt "Stall" but 001 will kinda glitch before inserting the info...
    You're probably seeing the screen update. It may look bad, but it's shouldn't be a problem.

    David


Posting Permissions

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