Mass Find and replace with offset - input vba

bmathew16

New Member
Joined
Feb 3, 2023
Messages
3
Office Version
  1. 365
Platform
  1. Windows
I am trying to make a vba for multiple people to enter data to update a master file.

The input file will start with a unique identifier (part number) in first column. The number of rows could be 1 or 100
Then based on the first column it will pull the other columns (about 10 but more could be added) in the master file. --- having trouble figuring out the loop to keep looking at offsets
There will be empty data in the columns i need it to ignore them.

Thanks a bunch updating this master file for our whole department has been a pain and is due for us to mess up the file.

My start to the vba...

Sub inputdata()


Dim Temptext As String
Dim Tempvalue As String
Worksheets("PFEP_Master").Select
Range("A2").Select


Worksheets("input").Select
Range("A2").Select
Temptext = ActiveCell.Value
Tempvalue = ActiveCell.Offset(0, 1).Value
Worksheets("PFEP_Master").Select
Do While ActiveCell.Value <> ""
Do While ActiveCell.Value <> ""
If ActiveCell.Value = Temptext Then
ActiveCell.Offset(0, 1).Value = Tempvalue
End If
ActiveCell.Offset(1, 0).Select
Loop
Range("A2").Select
Worksheets("input").Select
If ActiveCell.Offset(1, 0).Value = "" Then
Range("A1").Select
MsgBox "Data inputed", vbExclamation
Exit Sub
Else
ActiveCell.Offset(1, 0).Select
End If
Temptext = ActiveCell.Value
Tempvalue = ActiveCell.Offset(0, 2).Value
Worksheets("PFEP_Master").Select
Loop


End Sub
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
It would be easier to help if you could use the XL2BB add-in (icon in the menu) to attach a screenshot (not a picture) of your two sheet. Alternately, you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary).
 
Upvote 0
Here is the google drive with the file
Input is where people would be putting their data into and master would be where everything would be finalized.
 
Upvote 0
I having a little trouble understanding exactly what you want to do.
based on the first column it will pull the other columns (about 10 but more could be added) in the master file.
The input sheet has a drop down list of part numbers in column A. When you select a number in the drop down list, do you want to find the corresponding number in column A of Master PFEP and then copy data from columns in Master PFEP to the input sheet? If so, which columns do you want to copy? Please clarify in detail, step by step, using a few examples from your data.
 
Upvote 0
Here is the google drive with the file
Input is where people would be putting their data into and master would be where everything would be finalized.
I having a little trouble understanding exactly what you want to do.

The input sheet has a drop down list of part numbers in column A. When you select a number in the drop down list, do you want to find the corresponding number in column A of Master PFEP and then copy data from columns in Master PFEP to the input sheet? If so, which columns do you want to copy? Please clarify in detail, step by step, using a few examples from your data.
I originally was going to do an input file that a drp down would have helped but the data is being uploaded in larger chunks. This is the sequence i am trying to acheive:

Find value in all A column “input” sheet until no column has no data when matched in A column “PFEP” sheet then output offesets of all columns with data (in “input” sheet) to end at a certain number of columns in “input” sheet but don’t output if the cell is blank
I want any data from sheet “input” to overwrite data in “PFEP” but if its blank I don’t want to overwrite a blank cell in “input” in “PFEP”

1 If A column has value *do until?
3 keep finding column offsets (specific number of columns) * for next?
4 if no text do nothing
4b else go back to 3
2Then find column A value in sheet “input” in column A sheet in sheet “PFEP”
1B else no value stop
3b Else number of columns stop
 
Upvote 0
Currently the input sheet has data only in the the first 3 columns. That means that only columns B and C will be copied over to “PFEP”. Is this correct?
 
Upvote 0

Forum statistics

Threads
1,223,641
Messages
6,173,506
Members
452,518
Latest member
SoerenB

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top