Consulting

Results 1 to 11 of 11

Thread: How can I paste specific rows and replace specific rows

  1. #1
    VBAX Regular
    Joined
    Sep 2019
    Posts
    6
    Location

    Exclamation How can I paste specific rows and replace specific rows

    I am having trouble, I am new to VBA and I am trying to get (for example) rows 25, 40, 55 replaced in a 241 row document (going from one document to another) how can i do this? Alternatively how can i copy and especially paste based on unique ID names like I want to paste over row 25, "ham sandwich" but I don't want any other cells being replaced but I have to use a macro. Thanks in advance

  2. #2
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    271
    Location
    Using the Find method, find the cell in the sheet that contains the "ham sandwich". The Find method returns either Nothing (when not found) or a Range object. Check if the object found is on the specified row (on 25, 40 or 55). If the row found is not the one you are looking for, use FindNext to search further. Read in help how to construct a search, because FindNext can work "all around".

    Artik

  3. #3
    VBAX Regular
    Joined
    Sep 2019
    Posts
    6
    Location
    Do you have any examples? And can this be written into a macro? If so, I have no idea what that looks like

  4. #4
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    271
    Location
    First you show an example in the attached workbook what your data looks like and what you want to achieve.

    Artik

  5. #5

  6. #6
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    271
    Location
    Are you 100% sure that when sending data from the "Bob" file, the filter displays exactly the same records in the "Ham Sandwich" file as in the "Bob" file? If the answer is "No", then both files should use a unique record identifier, e.g. an ordinal number in the "Ham Sandwich" file.
    Regardless of the solution, when data is returned from "Bob" to "Ham Sandwich", the data should be moved record by record.

    Artik

  7. #7
    VBAX Regular
    Joined
    Sep 2019
    Posts
    6
    Location
    I have no idea i am just trying to automate pulling data from a filter onto a seperate work sheet inorder for a 3rd party to edit this seperate worksheet before sending it back and lets me 'somehow' transfer the now edited data from the seperate form into the existing worksheet without disrupting the non edited data in the existing worksheet, and i have no idea how to do this or if it is even possible

  8. #8
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    271
    Location
    It's possible, but as I mentioned, you could use the ID in the "Ham Sandwich" file. Do you have any influence on changing the data layout in this file (adding a column with identifier)?

    Artik

  9. #9
    VBAX Regular
    Joined
    Sep 2019
    Posts
    6
    Location
    I can do whatever i want with it, i have also found a problem where when i send the seperate worksheet off it becomes corrupt and i don't know if that is the macros or data validation

  10. #10
    VBAX Tutor
    Joined
    Dec 2008
    Posts
    271
    Location
    Without looking at the file, I can't tell you what the reason may be.

    However, I think I solved your main problem.

    Artik
    Attached Files Attached Files

  11. #11
    VBAX Regular
    Joined
    Sep 2019
    Posts
    6
    Location
    Thank you, would you be able to highlight the interchangable details? so things that could change when reusing the macro? on different forms?

Tags for this Thread

Posting Permissions

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