Excel Macro

Closed
pmwise Posts 2 Registration date Tuesday November 24, 2009 Status Member Last seen November 25, 2009 - Nov 25, 2009 at 05:37 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Nov 25, 2009 at 07:42 PM
Hello,
I want to write a macro which moves a cell value 'X' number of rows depending on the value entered in the cell on sheet 2 .

Thanks
Related:

2 responses

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Nov 25, 2009 at 05:46 AM
suppose cell A1 has X in sheet 1
and cell A1 in sheet 2 has entry 2
then you want to move x in a1 to a3. if this is the interpratiosn


Sub test()
Dim j As Integer
j = Worksheets("sheet2").Range("A1")
Worksheets("sheet1").Range("a1").Cut Worksheets("sheet1").Range("a1").Offset(j, 0)

End Sub


Then the original value in A3 will be lost.
0
pmwise Posts 2 Registration date Tuesday November 24, 2009 Status Member Last seen November 25, 2009
Nov 25, 2009 at 06:43 AM
Sorry for not being clear.
If A1 has X in sheet 1 and cell A1 in sheet 2 has entry 2
then I want to move x in a1 to c1.

So it stays on the same row but moves to column X depending on the value input in sheet 2.
0
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Nov 25, 2009 at 07:42 PM
change this line in the macro

Worksheets("sheet1").Range("a1").Offset(j, 0)

to

Worksheets("sheet1").Range("a1").Offset(0,j)
0