Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Array to find relative position - is there a better way? | Excel Worksheet Functions | |||
Relative position of Employees | Excel Worksheet Functions | |||
Excel Formula using relative position of cells in two different worksheets | Excel Worksheet Functions | |||
Visual Basic Macros, relative position | Charts and Charting in Excel | |||
Relative Cell position NOT working with or without macro | Excel Discussion (Misc queries) |