![]() |
MACRO TO COPY TO A RANGE
I want a macro to copy A1:D1 up to the end of an empty cell, then do the same
procedure for row 4 and so on and will stop only if the last row of the data in Col D=xxx (I dont know how to stop a macro and to loop in Excel, w/c I can do in Lotus). This would be an easy one for Macro experts and would appreciate your help since I'm new to Excel Macros. colA colB colC colD colE 1 aa bb cc dd 2 3 4 aa2 bb2 cc2 dd2 5 6 7 8 aa3 bb3 cc3 dd3 9 10 aa4 bb4 cc4 dd4 xxx |
MACRO TO COPY TO A RANGE
Not tested sub Printout_Ranges() dim i as integer i=0 Range("A1").select set a=selection do until i=4 a.offset(0,i).select a.end(xldown).select set z=selection if z.offset(0,i).value="" and a.offset(0,i).value="" then goto doop end if if z.offset(0,i).value="" then range(a.offset(0,i).printout=1 else range(a.offset(0,i).address, z.address).printout=1 end if Doop: i=i+1 loop end sub "asuncionw" wrote: I want a macro to copy A1:D1 up to the end of an empty cell, then do the same procedure for row 4 and so on and will stop only if the last row of the data in Col D=xxx (I dont know how to stop a macro and to loop in Excel, w/c I can do in Lotus). This would be an easy one for Macro experts and would appreciate your help since I'm new to Excel Macros. colA colB colC colD colE 1 aa bb cc dd 2 3 4 aa2 bb2 cc2 dd2 5 6 7 8 aa3 bb3 cc3 dd3 9 10 aa4 bb4 cc4 dd4 xxx |
MACRO TO COPY TO A RANGE
Thanks, will try it and let you know.
"exceluserforeman" wrote: Not tested sub Printout_Ranges() dim i as integer i=0 Range("A1").select set a=selection do until i=4 a.offset(0,i).select a.end(xldown).select set z=selection if z.offset(0,i).value="" and a.offset(0,i).value="" then goto doop end if if z.offset(0,i).value="" then range(a.offset(0,i).printout=1 else range(a.offset(0,i).address, z.address).printout=1 end if Doop: i=i+1 loop end sub "asuncionw" wrote: I want a macro to copy A1:D1 up to the end of an empty cell, then do the same procedure for row 4 and so on and will stop only if the last row of the data in Col D=xxx (I dont know how to stop a macro and to loop in Excel, w/c I can do in Lotus). This would be an easy one for Macro experts and would appreciate your help since I'm new to Excel Macros. colA colB colC colD colE 1 aa bb cc dd 2 3 4 aa2 bb2 cc2 dd2 5 6 7 8 aa3 bb3 cc3 dd3 9 10 aa4 bb4 cc4 dd4 xxx |
MACRO TO COPY TO A RANGE
Im getting syntax error on this line:
range(a.offset(0,i).printout=1 "exceluserforeman" wrote: Not tested sub Printout_Ranges() dim i as integer i=0 Range("A1").select set a=selection do until i=4 a.offset(0,i).select a.end(xldown).select set z=selection if z.offset(0,i).value="" and a.offset(0,i).value="" then goto doop end if if z.offset(0,i).value="" then range(a.offset(0,i).printout=1 else range(a.offset(0,i).address, z.address).printout=1 end if Doop: i=i+1 loop end sub "asuncionw" wrote: I want a macro to copy A1:D1 up to the end of an empty cell, then do the same procedure for row 4 and so on and will stop only if the last row of the data in Col D=xxx (I dont know how to stop a macro and to loop in Excel, w/c I can do in Lotus). This would be an easy one for Macro experts and would appreciate your help since I'm new to Excel Macros. colA colB colC colD colE 1 aa bb cc dd 2 3 4 aa2 bb2 cc2 dd2 5 6 7 8 aa3 bb3 cc3 dd3 9 10 aa4 bb4 cc4 dd4 xxx |
All times are GMT +1. The time now is 04:58 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com