+ Reply to Thread
Results 1 to 3 of 3

Search and Replace Problem Userform VBA

Hybrid View

Alan D Search and Replace Problem... 03-28-2012, 12:50 PM
Dennis7849 Re: Search and Replace... 03-28-2012, 01:09 PM
royUK Re: Search and Replace... 03-28-2012, 01:44 PM
  1. #1
    Registered User
    Join Date
    09-24-2010
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    1

    Search and Replace Problem Userform VBA

    hello

    My apoligies if I am not forwarding this query in the correct format
    Hoping that someone may be able to assist with my issue
    I have a Userform that I load data (from a different worksheet)
    The load fucntion is working fine, yet when I try to move updated data (from the userform) back to my data worksheet, the line is duplicated instead of replacding the data in the current row


    Workbooks.Open Filename:= _
    "T:\sh_proc\SHP-Specialized Folder\CSRush\CSRushData.xlsm"
    ActiveSheet.Unprotect Password:="team"
    Worksheets("Data").Select



    'Check Transaction Type

    Dim rng As Range


    Application.ScreenUpdating = False
    If rng Is Nothing Then GoTo skip
    For Each c In rng
    If r = 0 Then c.Select
    r = r - 1
    Next c
    skip:
    Set c = ActiveCell

    c.Value = TbTicket ' write amendments to database



    c.Offset(0, 0).Value = CSRushRequest.TbTicket.Value
    c.Offset(0, 1).Value = CSRushRequest.TextBox3.Value
    c.Offset(0, 2).Value = CSRushRequest.TextBox5.Value
    c.Offset(0, 3).Value = CSRushRequest.TextBox3.Value
    c.Offset(0, 4).Value = CSRushRequest.TxtName
    c.Offset(0, 5).Value = CSRushRequest.ComboBox9.Value
    c.Offset(0, 6).Value = OB20Value
    c.Offset(0, 7).Value = OB25Value
    c.Offset(0, 8).Value = OB30Value
    c.Offset(0, 9).Value = CSRushRequest.TextBox6.Value
    c.Offset(0, 10).Value = CSRushRequest.TxtEsr.Value
    c.Offset(0, 11).Value = CSRushRequest.TxtAccount.Value
    c.Offset(0, 12).Value = CSRushRequest.TextBox4.Value
    c.Offset(0, 13).Value = CSRushRequest.ComboBox7.Value
    c.Offset(0, 14).Value = CSRushRequest.ComboBox6.Value
    c.Offset(0, 15).Value = CSRushRequest.TbComments
    c.Offset(0, 16).Value = CSRushRequest.TextBox7.Value
    c.Offset(0, 17).Value = CSRushRequest.TextBox3.Value
    c.Offset(0, 18).Value = CSRushRequest.ComboBox8.Text
    c.Offset(0, 19).Value = CSRushRequest.TextBox8.Text
    c.Offset(0, 20).Value = CSRushRequest.TextBox3.Value
    c.Offset(0, 21).Value = CSRushRequest.TxtName

  2. #2
    Valued Forum Contributor
    Join Date
    03-14-2012
    Location
    Arizona USA
    MS-Off Ver
    Excel 2000/2007
    Posts
    408

    Re: Search and Replace Problem Userform VBA

    Why not try this


    Cells(c.Row, c.Column+0).Value = CSRushRequest.TbTicket.Value
    Cells(c.Row, c.Column+1).Value = CSRushRequest.TextBox3.Value
    .
    .
    .

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Search and Replace Problem Userform VBA

    Both of you

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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