Welcome to Windows Help!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

need help on macro/VBA programming selecting a range

 
   Windows Help (Home) -> Microsoft Excel RSS
Next:  Print spooler error kills printer useage  
Author Message
Ron Berns

External


Since: Jun 18, 2009
Posts: 1



(Msg. 1) Posted: Thu Jun 18, 2009 4:58 pm
Post subject: need help on macro/VBA programming selecting a range
Archived from groups: microsoft>public>excel (more info?)

I would like a macro to allow a user to select a cell in column A on Sheet 2.
If the user selects A6 I would like the macro to select the Range (A6:BF6) in Sheet2 and copy that to Sheet1 starting in cell A1.

Thank You in advance.

Ron

 >> Stay informed about: need help on macro/VBA programming selecting a range 
Back to top
Login to vote
Gord Dibben

External


Since: Oct 17, 2008
Posts: 21



(Msg. 2) Posted: Thu Jun 18, 2009 4:58 pm
Post subject: Re: need help on macro/VBA programming selecting a range
Archived from groups: per prev. post (more info?)

Sub Copy_to_Sht1()
Range(ActiveCell, Range("BF" & ActiveCell.Row)).Copy _
Destination:=Sheets("Sheet1").Range("A1")
End Sub


Gord Dibben MS Excel MVP


On Thu, 18 Jun 2009 16:58:32 -0500, Ron Berns
wrote:

>
>I would like a macro to allow a user to select a cell in column A on Sheet 2.
>If the user selects A6 I would like the macro to select the Range (A6:BF6) in Sheet2 and copy that to Sheet1 starting in cell A1.
>
>Thank You in advance.
>
>Ron

 >> Stay informed about: need help on macro/VBA programming selecting a range 
Back to top
Login to vote
Shane Devenshire

External


Since: Nov 13, 2008
Posts: 17



(Msg. 3) Posted: Thu Jun 18, 2009 9:56 pm
Post subject: RE: need help on macro/VBA programming selecting a range
Archived from groups: per prev. post (more info?)

Hi,

This might do what you want

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim isect As Range
Set isect = Application.Intersect(Target, [A:A])
If Not isect Is Nothing Then
Range(Target, Range("BF" & Target.Row)).Copy Sheet1.[A1]
End If
End Sub

1. To add this code to your file, press Alt+F11,
2. In the VBAProject window, top left side, find your sheet name under your
file name and double click it.
3. Paste in or type the code above.

Whether this macro does what you want depends on what you mean by "starting
in cell A1"
 >> Stay informed about: need help on macro/VBA programming selecting a range 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
How to make a SumIf range not a range ... but a sum of spe.. - =SUMIF(D3,AL3,"=H3+J3+L3+N3+P3+R3+T3+V3+X3+Z3+AB3+AD3") Here is what I am trying to do: If D3 = AL3 then I want it to return the sum of H3+J3+L3+N3+P3+R3+T3+V3+X3+Z3+AB3+AD3 I know it is something simple I am missing .......

how to populate a range with another range of data ? - Hi - imagine that I have 2 worksheets in my workbook. Worksheet 'MASTER' 5 columns x 4 rows Column 1 = KEY and Columns 2 - 5 = numbers (data) Worksheet 'DATA' 4 columns x 12 rows (3 groups of 4 rows) I have been trying to use a combo-box t...

Range of an Excel Sheet - I want to open a linked Excel Sheet with the appropriate range. The excel filename / range I have is the following: C:\Documents and Settings\aparmar\Desktop\Book1.xslx!Sheet!R1C1:R5C2 I'm opening the following by stripping of the extra information...

Using Named Range in LOOKUP formula? - My LOOKUP formula currently reads: =((LOOKUP($I6,$A$2:$A$7,$D$2:$D$7)-J6)+(LOOKUP($I6,$A$2:$A$7,$G$2:$G $7))) I would like to change this so the ranges are columns in a Named Range. Something like: =((LOOKUP($I6,Range_Col1,Range_Col4)-J6)+..

Counting Soecific dates in a range - Hi, I have a series of dates in A3:A1000 and I only want to count the dates in September 2009 **/09/09 (UK date format) in that range. I looked at COUNT, COUNTIF etc. but they only seem to look for text strings. I seem to be going around in circles..
   Windows Help (Home) -> Microsoft Excel All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]