excel - Multiple cells selecting and copying to a single row on another worksheet -


i've been looking around past couple days , can't seem find me accomplish i'm trying do.

i have sheet contains data in multiple cells user inputs - when user hits submit button vba macro copy data multiple cells , paste worksheet on single row (last row) can pull data later , make changes if needed. worksheet has unique id on top , when searched pull data worksheet , make edits , save again.

when record macro , try multiple select doesn't let me copy code supplies select

sub copy() ' ' copy macro '      union(range( _         "j22:k22,m22,i24:j24,k24:l24,m24,i26:j26,k26:l26,m26,b29:d29,e29:g29,b30:d30,b31:d31,b33:d33,e33:g33,i29,j29:k29,m29,i31:j31,k31:l31,m31,i33:j33,k33:l33,m33,b36:d36,b37:d37,b38:d38,e36:g36,b40:d40,e40:g40,i36,j36:k36,m36" _         ), range( _         "i38:j38,k38:l38,m38,i40:j40,k40:l40,m40,b2:f3,b2:f3,b6:e6,f7:g7,b7:e7,b8:e8,b9:e9,b11:c11,d11:e11,b13:c13,d13:e13,i3:l3,l2,m1,i6:l6,i7:l7,i8:l8,i9:l9,m7,i11:j11,k11:l11,i13:j13,k13:l13,b15:m16,b18:m19,b22:d22" _         ), range("b23:d23,b24:d24,e22:g22,b26:d26,e26:g26,i22")).select  end sub 

this cells need copy on , paste "entries" worksheet in same workbook. i'm sure has asked before i'm not sure i'm not using right key words search i'm not finding anything. allot of stuff copying multiple row , columns , pasting nothing multiple cells.

i think you're trying do

sub test() dim rng range set rng = union(range( _         "j22:k22,m22,i24:j24,k24:l24,m24,i26:j26,k26:l26,m26,b29:d29,e29:g29,b30:d30,b31:d31,b33:d33,e33:g33,i29,j29:k29,m29,i31:j31,k31:l31,m31,i33:j33,k33:l33,m33,b36:d36,b37:d37,b38:d38,e36:g36,b40:d40,e40:g40,i36,j36:k36,m36" _         ), range( _         "i38:j38,k38:l38,m38,i40:j40,k40:l40,m40,b2:f3,b2:f3,b6:e6,f7:g7,b7:e7,b8:e8,b9:e9,b11:c11,d11:e11,b13:c13,d13:e13,i3:l3,l2,m1,i6:l6,i7:l7,i8:l8,i9:l9,m7,i11:j11,k11:l11,i13:j13,k13:l13,b15:m16,b18:m19,b22:d22" _         ), range("b23:d23,b24:d24,e22:g22,b26:d26,e26:g26,i22"))  dim wsentries worksheet set wsentries = sheets("entries")  dim lastrow integer lastrow = wsentries.cells(rows.count, "a").end(xlup).row  dim integer = 1 each c in rng     wsentries.cells(lastrow + 1, i) = c     = + 1 next   end sub 

it iterate through range left right top bottom.

are sure want use unionkb though? you set range cells think used union due character limit of function. did mean use intersect kb?


to clear you're working 3 ranges here -

range("j22:k22,m22,i24:j24,k24:l24,m24,i26:j26,k26:l26,m26,b29:d29,e29:g29,b30:d30,b31:d31,b33:d33,e33:g33,i29,j29:k29,m29,i31:j31,k31:l31,m31,i33:j33,k33:l33,m33,b36:d36,b37:d37,b38:d38,e36:g36,b40:d40,e40:g40,i36,j36:k36,m36")  range("i38:j38,k38:l38,m38,i40:j40,k40:l40,m40,b2:f3,b2:f3,b6:e6,f7:g7,b7:e7,b8:e8,b9:e9,b11:c11,d11:e11,b13:c13,d13:e13,i3:l3,l2,m1,i6:l6,i7:l7,i8:l8,i9:l9,m7,i11:j11,k11:l11,i13:j13,k13:l13,b15:m16,b18:m19,b22:d22")  range("b23:d23,b24:d24,e22:g22,b26:d26,e26:g26,i22") 

no cells intersect 3 ranges.

b2:f3 twice listed in second range. otherwise don't see overlap.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -