Conditional Copy paste with NEXT and BACK Button

nasrullah

New Member
Joined
Apr 19, 2009
Messages
10
Dear Team,

In my sheet (photo in the link), i have data from A1:F20.
Column A got Primary Key (Pkey). When i select the Pkey cell range and press the button (button code as below) it copy paste the selected cells to Range H2 on wards. Then a vlookup fill my my other columns (I:K) data.
Its marking the font color red - So i know which i select before.

Now, i need a the button to paste the Pkey only if if the column F = Yes.

Second, i need a next and previous buttons code to select group of primary key which has the same code (in column B)

Code:
Sub Button1_Click()
 Sheets("sheet1").Range("h2:G20").Clear
    Selection.Cells.Font.Color = RGB(256, 0, 0)
    Selection.Copy
    Sheets("Sheet1").Range("h2").PasteSpecial Paste:=xlPasteValues
    
    Application.CutCopyMode = False
End Sub

These are test data not real data or person name.
https://ibb.co/MnKDZ90
https://ibb.co/stx1SRF
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I am posting after very long time, if any mistake i did or again any forum rule, please advise.
i could not attache my sample file here.
 
Upvote 0

Forum statistics

Threads
1,214,951
Messages
6,122,449
Members
449,083
Latest member
Ava19

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