Hi guys,
I have this VBA to select cell B3,C3 and D3 which copies to a column N5, N6 and N7
I would like to know how to select any cell in column B plus including the 2 cells next to it like above and copy these to the columns N5, N6 and N7
anyone help me out please?
Thanks you
I have this VBA to select cell B3,C3 and D3 which copies to a column N5, N6 and N7
I would like to know how to select any cell in column B plus including the 2 cells next to it like above and copy these to the columns N5, N6 and N7
Code:
[COLOR=#011993][FONT=Menlo]Sub Cells()[/FONT][/COLOR][FONT=Menlo]
[/FONT]
[COLOR=#000000][FONT=Menlo][COLOR=#011993]Dim[/COLOR] CopyData [COLOR=#011993]As[/COLOR] Range[/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo][COLOR=#011993]Dim[/COLOR] cell [COLOR=#011993]As[/COLOR] Range[/FONT][/COLOR]
[COLOR=#011993][FONT=Menlo]Dim[COLOR=#000000] x [/COLOR]AsInteger[/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[COLOR=#000000][FONT=Menlo]x = 0[/FONT][/COLOR]
[COLOR=#011993][FONT=Menlo]Set CopyData = Range("[/FONT][/COLOR][COLOR=#011993][FONT=Menlo]B3, C3, D3[/FONT][/COLOR][COLOR=#011993][FONT=Menlo]")[/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[COLOR=#000000][FONT=Menlo][COLOR=#011993]For[/COLOR] [COLOR=#011993]Each[/COLOR] cell [COLOR=#011993]In[/COLOR] CopyData[/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo] Range("N5").Offset(x) = cell.Value[/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo] x = x + 1[/FONT][/COLOR]
[COLOR=#000000][FONT=Menlo][COLOR=#011993]Next[/COLOR] cell[/FONT][/COLOR]
[FONT=Menlo]
[/FONT]
[COLOR=#011993][FONT=Menlo]EndSub[/FONT][/COLOR]
anyone help me out please?
Thanks you