Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default How to macro to relative position

Sheet2.Select
Range("A2").Select
Selection.Copy
Sheet1.Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Input Sheet").Select
Range("B2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Input View").Select
Range("C1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

How to I get the range select to be relative?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default How to macro to relative position

Hmm... *which* range select, and *how* relative?

In article ,
jk9533 wrote:

Sheet2.Select
Range("A2").Select
Selection.Copy
Sheet1.Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Input Sheet").Select
Range("B2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Input View").Select
Range("C1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

How to I get the range select to be relative?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default How to macro to relative position

Range("A2").Select
I linked this macro to a button on the same row. So if they push the button
on row 2 it should read A2. If they push the button on row3 then A3 and so
on and so on.

Any help you can provide is greatly appreciated.

"JE McGimpsey" wrote:

Hmm... *which* range select, and *how* relative?

In article ,
jk9533 wrote:

Sheet2.Select
Range("A2").Select
Selection.Copy
Sheet1.Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Input Sheet").Select
Range("B2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Input View").Select
Range("C1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

How to I get the range select to be relative?


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default How to macro to relative position

One way:

With ActiveCell
If .Parent.Name = "Input Sheet" Then
Sheet1.Range("A1").Value = .Parent.Cells(.Row, 1).Value
Sheet1.Range("C1").Value = .Parent.Cells(.Row, 2).Value
End If
End With

(Assuming Sheet2 = "Input Sheet" and Sheet1 = "Input View")


In article ,
jk9533 wrote:

Range("A2").Select
I linked this macro to a button on the same row. So if they push the button
on row 2 it should read A2. If they push the button on row3 then A3 and so
on and so on.

Any help you can provide is greatly appreciated.

"JE McGimpsey" wrote:

Hmm... *which* range select, and *how* relative?

In article ,
jk9533 wrote:

Sheet2.Select
Range("A2").Select
Selection.Copy
Sheet1.Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Input Sheet").Select
Range("B2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Input View").Select
Range("C1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

How to I get the range select to be relative?


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default How to macro to relative position

Not quite.

I need the macro to copy and paste A(X) from Sheet1 to $A$1 of Sheet2 based
on the row position of A(X).

So if I click the button on row 1 on sheet 1 then it will pasts the value of
A1 sheet1 on Sheet2 $A$1. If I click the button on row2 on sheet 1 then it
will paste the value of A2 sheet1 on Sheet2 $A$1

Any suggestions

"JE McGimpsey" wrote:

One way:

With ActiveCell
If .Parent.Name = "Input Sheet" Then
Sheet1.Range("A1").Value = .Parent.Cells(.Row, 1).Value
Sheet1.Range("C1").Value = .Parent.Cells(.Row, 2).Value
End If
End With

(Assuming Sheet2 = "Input Sheet" and Sheet1 = "Input View")


In article ,
jk9533 wrote:

Range("A2").Select
I linked this macro to a button on the same row. So if they push the button
on row 2 it should read A2. If they push the button on row3 then A3 and so
on and so on.

Any help you can provide is greatly appreciated.

"JE McGimpsey" wrote:

Hmm... *which* range select, and *how* relative?

In article ,
jk9533 wrote:

Sheet2.Select
Range("A2").Select
Selection.Copy
Sheet1.Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Input Sheet").Select
Range("B2").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Input View").Select
Range("C1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub

How to I get the range select to be relative?




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default How to macro to relative position

Hmm... that's the opposite of your recorded macro, but the change is
simple:

With ActiveCell
If .Parent.Name = Sheet1.Name Then
Sheet2.Range("A1").Value = .Parent.Cells(.Row, 1).Value
Sheet2.Range("C1").Value = .Parent.Cells(.Row, 2).Value
End If
End With


This assumes that by "click the button on row2" you mean, "click the
button with a cell on row 2 active". If you actually have different
buttons, then the answer will depend on what kind of button (i.e., Forms
toolbar or Controls Toolbox).


In article ,
jk9533 wrote:

Not quite.

I need the macro to copy and paste A(X) from Sheet1 to $A$1 of Sheet2 based
on the row position of A(X).

So if I click the button on row 1 on sheet 1 then it will pasts the value of
A1 sheet1 on Sheet2 $A$1. If I click the button on row2 on sheet 1 then it
will paste the value of A2 sheet1 on Sheet2 $A$1

Any suggestions

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default How to macro to relative position

Thanks it works

"JE McGimpsey" wrote:

Hmm... that's the opposite of your recorded macro, but the change is
simple:

With ActiveCell
If .Parent.Name = Sheet1.Name Then
Sheet2.Range("A1").Value = .Parent.Cells(.Row, 1).Value
Sheet2.Range("C1").Value = .Parent.Cells(.Row, 2).Value
End If
End With


This assumes that by "click the button on row2" you mean, "click the
button with a cell on row 2 active". If you actually have different
buttons, then the answer will depend on what kind of button (i.e., Forms
toolbar or Controls Toolbox).


In article ,
jk9533 wrote:

Not quite.

I need the macro to copy and paste A(X) from Sheet1 to $A$1 of Sheet2 based
on the row position of A(X).

So if I click the button on row 1 on sheet 1 then it will pasts the value of
A1 sheet1 on Sheet2 $A$1. If I click the button on row2 on sheet 1 then it
will paste the value of A2 sheet1 on Sheet2 $A$1

Any suggestions


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
Array to find relative position - is there a better way? John Michl Excel Worksheet Functions 3 October 8th 07 04:47 PM
Relative position of Employees Bob Davison Excel Worksheet Functions 9 May 8th 07 07:23 PM
Excel Formula using relative position of cells in two different worksheets David Virgil Hobbs Excel Worksheet Functions 1 December 14th 06 03:36 AM
Visual Basic Macros, relative position [email protected] Charts and Charting in Excel 3 November 14th 06 11:33 PM
Relative Cell position NOT working with or without macro Scratching my Head Excel Discussion (Misc queries) 6 May 30th 05 06:12 PM


All times are GMT +1. The time now is 02:34 AM.

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

About Us

"It's about Microsoft Excel"