PDA

View Full Version : Macro to copy value in another sheet in certain manner.



coolhit
02-10-2009, 02:31 PM
Hi,
I am need of some assistant, please could some help out.

I have recorded a macro but how do i make loop over and over until it get 0 value.

In MULTI LINE sheet there is a button which user press to activate macro.

as the button is pressed information from MULTI LINE BREAK DOWN sheet is copied over to PREVIEW MULTI LINE LABEL sheet

Example - MULTI LINE BREAK DOWN sheet row2
Column A - goes to cell A2 in PREVIEW MULTI LINE LABLE
Column B - goes to cell B3 in PREVIEW MULTI LINE LABEL
Column C - goes to cell A1 in PREVIER MULTI LINE LABEL

Example - MULTI LINE BREAK DOWN sheet row3
Column A - goes to cell E2 in PREVIEW MULTI LINE LABLE
Column B - goes to cell F3 in PREVIEW MULTI LINE LABEL
Column C - goes to cell E1 in PREVIER MULTI LINE LABEL

In short
ROW2 Info goes to Left Hand side
ROW3 Info goes to Right Hand side
move down
ROW4 Info goes to Left Hand Side
ROW5 Info goes to Right Hand Side

My MACRO codeing is

Code:
Range("A1").SelectActiveCell.FormulaR1C1 = "='MULTI LINE BREAK DOWN'!R[1]C[2]&"" /"""Range("A2:B2").SelectActiveCell.FormulaR1C1 = "=arg('MULTI LINE BREAK DOWN'!RC)"Range("B3").SelectActiveCell.FormulaR1C1 = "='MULTI LINE BREAK DOWN'!R[-1]C&"" """Range("E1").SelectActiveCell.FormulaR1C1 = "='MULTI LINE BREAK DOWN'!R[2]C[-2]&"" /"""Range("E2:F2").SelectActiveCell.FormulaR1C1 = "=arg('MULTI LINE BREAK DOWN'!R[1]C[-4])"Range("F3").SelectActiveCell.FormulaR1C1 = "='MULTI LINE BREAK DOWN'!RC[-4]&"" """Range("A4").SelectActiveCell.FormulaR1C1 = "='MULTI LINE BREAK DOWN'!RC[2]&"" /"""Range("A5:B5").SelectActiveCell.FormulaR1C1 = "=arg('MULTI LINE BREAK DOWN'!R[-1]C)"Range("B6").SelectActiveCell.FormulaR1C1 = "='MULTI LINE BREAK DOWN'!R[-2]C&"" """Range("E4").SelectActiveCell.FormulaR1C1 = "='MULTI LINE BREAK DOWN'!R[1]C[-2]&"" /"""Range("E5:F5").SelectActiveCell.FormulaR1C1 = "=arg('MULTI LINE BREAK DOWN'!RC[-4])"Range("F6").SelectActiveCell.FormulaR1C1 = "='MULTI LINE BREAK DOWN'!R[-1]C[-4]&"" """Range("A7").SelectActiveCell.FormulaR1C1 = "='MULTI LINE BREAK DOWN'!R[-1]C[2]&"" /"""Range("A8:B8").SelectActiveCell.FormulaR1C1 = "=arg('MULTI LINE BREAK DOWN'!R[-2]C)"Range("B9").SelectActiveCell.FormulaR1C1 = "='MULTI LINE BREAK DOWN'!R[-3]C&"" """Range("E7").SelectActiveCell.FormulaR1C1 = "='MULTI LINE BREAK DOWN'!R[1]C[-2]&"" /"""Range("E8:F8").SelectActiveCell.FormulaR1C1 = "=arg('MULTI LINE BREAK DOWN'!R[-1]C[-4])"Range("F9").SelectActiveCell.FormulaR1C1 = "='MULTI LINE BREAK DOWN'!R[-2]C[-4]&"" """Range("F10").Select
This codeing is up to 6 rows. In MULTI LINE BREAK DOWN sheet i can have to 60,80,130,etc rows worth of information. In this sheet column A has zero value then it should stop.

Can someone please assist me. any help would be appricated.

MaximS
02-10-2009, 05:11 PM
that might solve your problem, see attached file for details