PC Review


Reply
Thread Tools Rate Thread

Code for activating shift key

 
 
=?Utf-8?B?QkNMaXZlbGw=?=
Guest
Posts: n/a
 
      6th Jun 2007
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 With Quote
 
 
 
 
JE McGimpsey
Guest
Posts: n/a
 
      6th Jun 2007
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 <7ECE54E9-04A9-4D23-B2D4-(E-Mail Removed)>,
BCLivell <(E-Mail Removed)> 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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
protection de-activating tab-naming code =?Utf-8?B?U3RpbGxh?= Microsoft Excel Worksheet Functions 2 23rd May 2006 05:21 PM
Shift and Arrow Key Code strung Microsoft Excel New Users 4 28th Oct 2005 02:07 PM
code to prompt before activating changes =?Utf-8?B?bWhtYWlk?= Microsoft Excel New Users 1 18th Aug 2005 02:05 AM
Re Activating XP or Re entering product code =?Utf-8?B?V2luZw==?= Windows XP Help 1 18th Jan 2005 10:54 PM
What is the VBA code for Zoom or Shift F2? M Skabialka Microsoft Access Forms 2 18th Jul 2003 04:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:11 PM.