Please Help with VBA...

NPA1984

New Member
Joined
Jan 19, 2015
Messages
2
I really need some help with VBA On my sheet Row 2 is where I will enter in the values that I want moved into the table below, based on the EE# I have put into A2. I have a table with raw data below this, each row has a number assigned to it called EE# I would like to have VBA do the following when I press the button: Copy the data I entered into row 2 and paste it into the row with the same EE# IF Cell A2 = A10 then copy data from D2 into D10 and F2 into F10 if A2 does not equal A10, check if A2 = A11 if so copy D2 paste in D11, copy F2 paste in F11, and continue until the end of the table. If no match then msg box "Error - No EE# in table" Right now my table is sorted largest EE# on top and smallest on the Bottom
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
try this:
Code:
Sub test()
EEnum = Cells(2, 1)
lr_table = Cells(Rows.Count, 1).End(xlUp).Row
x = 1
For i = 10 To lr_table
    If Cells(i, 1) = EEnum Then
        Cells(i, "D") = Cells(2, "D")
        Cells(i, "F") = Cells(2, "F")
        x = x + 1
    End If
Next i
If x = 1 Then
    MsgBox "Error - No EE# in table"
End If
End Sub
<
 
Upvote 0

Forum statistics

Threads
1,215,394
Messages
6,124,683
Members
449,180
Latest member
kfhw720

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