+ Reply to Thread
Results 1 to 8 of 8

Find cell and enter data

  1. #1
    Registered User
    Join Date
    06-09-2011
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10

    Find cell and enter data

    Hello Everybody

    I am trying to write a macro to get data from sheet "2" and enter it on the
    corresponding cell in the sheet "SL". Please find the attached xls in 3rd Quote

    The problem which I am facing is there is no consitency in the results
    for every run of the macro. I will appreciate responses from experts on this
    forum.
    I am low/ mid level vb programmer.

    Please help.
    Last edited by KTELANG; 07-27-2011 at 01:40 PM.

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Find cell and enter data

    It would be helpful if you could describe your problem a little better. I see no relation between the two sheets in your sample workbook, and I can't tell what your code is trying to do.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Registered User
    Join Date
    06-09-2011
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Find cell and enter data

    Quote Originally Posted by davegugg View Post
    It would be helpful if you could describe your problem a little better. I see no relation between the two sheets in your sample workbook, and I can't tell what your code is trying to do.
    Thanks for the reply
    Sorry for the confusion.
    My bad, I attached a wrong sheet please find the new attachment.

    The sheet "2" has set of columns 1st has names say SB1-01 which is addressed with "strToFind" parameter in the macro
    and 2nd is value which is "copycell"
    I want the macro to go to sheet "SL" and then look for the "strToFind"
    and enter the value "copycell" next to it

    Thanks
    Attached Files Attached Files
    Last edited by KTELANG; 07-27-2011 at 01:43 PM.

  4. #4
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Find cell and enter data

    Does it have to be a macro, or can you use a VLOOKUP instead?

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-09-2011
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Find cell and enter data

    Quote Originally Posted by davegugg View Post
    Does it have to be a macro, or can you use a VLOOKUP instead?

    Please Login or Register  to view this content.
    Thanks for that suggestion
    but it has to be a macro as similar to sheet "2"
    there will be 100 other sheets coming in and
    the values will be getting updated in "SL"

    if you had a chance to take a look the
    pastecell.Value = pastecell.Value + copycell..
    will update the values

    Thanks

  6. #6
    Registered User
    Join Date
    06-09-2011
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Find cell and enter data

    Quote Originally Posted by KTELANG View Post
    Thanks for that suggestion
    but it has to be a macro as similar to sheet "2"
    there will be 100 other sheets coming in and
    the values will be getting updated in "SL"

    if you had a chance to take a look the
    pastecell.Value = pastecell.Value + copycell..
    will update the values

    Thanks
    PLease can you comment about the

    Set uRange = ActiveSheet.Range("A1:A900")
    Set Findtxt = uRange.Find(strToFind)

    in the code.. I am not sure I have written in right

  7. #7
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Find cell and enter data

    You need to set the uRange on the sheet you are searching, not the active sheet:

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    06-09-2011
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Find cell and enter data

    Quote Originally Posted by KTELANG View Post
    PLease can you comment about the

    Set uRange = ActiveSheet.Range("A1:A900")
    Set Findtxt = uRange.Find(strToFind)

    in the code.. I am not sure I have written in right
    Thanks for your help
    I figured out that

+ 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