PDA

View Full Version : How can I paste specific rows and replace specific rows



Rhirhi
09-11-2019, 01:13 AM
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

Artik
09-11-2019, 01:36 AM
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

Rhirhi
09-11-2019, 01:42 AM
Do you have any examples? And can this be written into a macro? If so, I have no idea what that looks like

Artik
09-11-2019, 01:51 AM
First you show an example in the attached workbook what your data looks like and what you want to achieve. :)

Artik

Rhirhi
09-13-2019, 03:27 AM
2505325052

Artik
09-13-2019, 03:58 AM
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

Rhirhi
09-13-2019, 04:13 AM
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

Artik
09-13-2019, 04:42 AM
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

Rhirhi
09-13-2019, 04:51 AM
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

Artik
09-13-2019, 06:45 AM
Without looking at the file, I can't tell you what the reason may be.

However, I think I solved your main problem.

Artik

Rhirhi
09-16-2019, 01:54 AM
Thank you, would you be able to highlight the interchangable details? so things that could change when reusing the macro? on different forms?