Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need help with finding code that will virtually hold down the shift key. I
code that will select one cell and then i have it finding a second cell but I it to "hold the shift key" inbetween so it copies all of the cels inbetween. See below for the code i have so far. thank you! Private Sub CommandButton1_Click() Dim rng As Range Dim cell As Range Set rng = Range("B1:B1000") startrow = Columns(2).Find("example 1").Select ActiveCell.Copy ****Hold shift key**** startrow = Columns(2).Find("example 2").Select ActiveCell.Copy ***End holding shift key**** End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How about:
Private Sub CommandButton1_Click() Dim r1 As Range Dim r2 As Range With Range("B:B") Set r1 = .Find("example 1") If Not r1 Is Nothing Then Set r2 = .Find("example 2") If Not r2 Is Nothing Then Range(r1, r2).Copy _ Destination:=Sheets("Sheet2").Range("A1") End If End If End With End Sub In article , BCLivell wrote: I need help with finding code that will virtually hold down the shift key. I code that will select one cell and then i have it finding a second cell but I it to "hold the shift key" inbetween so it copies all of the cels inbetween. See below for the code i have so far. thank you! Private Sub CommandButton1_Click() Dim rng As Range Dim cell As Range Set rng = Range("B1:B1000") startrow = Columns(2).Find("example 1").Select ActiveCell.Copy ****Hold shift key**** startrow = Columns(2).Find("example 2").Select ActiveCell.Copy ***End holding shift key**** End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
protection de-activating tab-naming code | Excel Worksheet Functions | |||
Shift and Arrow Key Code | New Users to Excel | |||
code to prompt before activating changes | New Users to Excel | |||
Activating/De-activating buttons | Excel Programming |