Hello Forum,
This is my code in Module1
Code
Sub Rand()
Dim ws As Worksheet
Dim stRow As Long, endRow As Long, dataCol As Long
Dim dispRow As Long, dispCol As Long
Set ws = Sheets("Sheet1")
stRow = 3
dataCol = 1
dispRow = 4
dispCol = 7
With ws
endRow = .Cells(.Rows.Count, dataCol).End(xlUp).Row
.Cells(dispRow, dispCol).Value = _
.Cells(Application.RandBetween(stRow, endRow), dataCol).Value
End With
End Sub
Display More
This code is embedded into Button 1. I'd like to add two macros to run when Button 1 was clicked:
Code
Target Private Sub Workbook_SheetSelectionChange(ByVal Target As Range)
Application.CutCopyMode = False
Target.Range("G4").Copy
End Sub
and
Code
Sub Lister()
Dim lRow As Long
lRow = Worksheets("Sheet2").Cells(Worksheets("Sheet2").Rows.Count, 1).End(xlUp).Row
Worksheets("Sheet2").Range("A" & lRow + 1 & ":C" & lRow + 1).Value = Worksheets("Sheet1").Range("F3:H3").Value
End Sub
The very first one works like a charm already; random selections.
Other two codes (Thanks Ozgrid's Carim for the last one) also work.. I tried to add / embed to codes into the Module1 but no success.
What I want to do is when clicked once, random selection will be displayed, the value is to be copied to the clipboard, and random selection cells will be copied to another sheet.
Any help would be great. Thanks in advance.
Onexc