Consulting

Results 1 to 10 of 10

Thread: Need help with command button

  1. #1
    VBAX Regular
    Joined
    Nov 2007
    Posts
    23
    Location

    Need help with command button

    Hi all,

    I'm a newbie in VBA, I'm trying to program a command button or a function that will fill in the empty cells in a specific range or row in my sheet by "-".


    Thanks in advance for all your help.

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    What is the specific range Chuck?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Regular
    Joined
    Nov 2007
    Posts
    23
    Location
    Hey Steve,

    D11 to AY47

    But it has to be only on the active row.

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    every cell in the row from D to AY that is blank?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    VBAX Regular
    Joined
    Nov 2007
    Posts
    23
    Location
    Yes.
    Is it easier if I sent you my file ?

  6. #6
    VBAX Regular
    Joined
    Nov 2007
    Posts
    23
    Location
    Any help ??

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Public Sub ProcessData()
    Dim cell As Range
    For Each cell In Intersect(Rows(ActiveCell.Row), Range("D11:AY47"))
    If cell.Value = "" Then cell.Value = "-"
    Next cell
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  8. #8
    VBAX Regular
    Joined
    Nov 2007
    Posts
    23
    Location
    Thank you so much.

  9. #9
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    I'm just too slow to keep up with Bob....
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  10. #10
    VBAX Regular
    Joined
    Nov 2007
    Posts
    23
    Location
    Ah don't worry about it
    All your help has been great and very much appreciated.

Posting Permissions

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