Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Code for activating shift key

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Code for activating shift key

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
protection de-activating tab-naming code Stilla Excel Worksheet Functions 2 May 23rd 06 05:21 PM
Shift and Arrow Key Code strung New Users to Excel 4 October 28th 05 02:07 PM
code to prompt before activating changes mhmaid New Users to Excel 1 August 18th 05 02:05 AM
Activating/De-activating buttons Nash Excel Programming 4 June 22nd 05 07:24 AM


All times are GMT +1. The time now is 03:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"