How to copy format of a column using spin button

Tyberian1988

New member
Joined
Mar 5, 2014
Messages
3
Reaction score
0
Points
0
hello everybody! i'm a new member on this forum and a beginner in programming.I would like to know how to paste the format of column(a) in column(c),(d),(e)...etc using a spin button.I need an increment for the pasted format. Any help, please?
Here is a copy of my code:

Code:
[COLOR=#333333]Private Sub SpinButton1_SpinUp()[/COLOR]

[COLOR=#333333]Columns("A").Select[/COLOR]
[COLOR=#333333]Selection.Copy[/COLOR]
[COLOR=#333333]Columns("C").Select[/COLOR]

[COLOR=#333333]Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _[/COLOR]
[COLOR=#333333]SkipBlanks:=False, Transpose:=False[/COLOR]
[COLOR=#333333]Application.CutCopyMode = False[/COLOR]

[COLOR=#333333]End Sub[/COLOR]
 
Last edited by a moderator:

Zack Barresse

Super Moderator
Staff member
Joined
Mar 16, 2011
Messages
112
Reaction score
0
Points
0
Location
Oregon, United States
Excel Version(s)
365, Online, iOS, iOS for iPad
Can you explain a little more what your data structure is and what you're trying to achieve more specifically? It's not entirely obvious what you want. Perhaps a detailed example of what you're doing? I'm not sure how a spinner button comes into play here. If you want to use the value of the spinner as an offset to the column being copied, use the linked cell of the spinner in with the Offset method of the Range object.
 

Tyberian1988

New member
Joined
Mar 5, 2014
Messages
3
Reaction score
0
Points
0
Can you explain a little more what your data structure is and what you're trying to achieve more specifically? It's not entirely obvious what you want. Perhaps a detailed example of what you're doing? I'm not sure how a spinner button comes into play here. If you want to use the value of the spinner as an offset to the column being copied, use the linked cell of the spinner in with the Offset method of the Range object.


I'm trying to copy the format from column(A) to column(C) when i click the up spin button.At the second click i want to copy the format from column(A) to column(D) and so on.When i click the down spin button i want to delete the formats, but i want it to stop at column(B).Excuse my english.
 

Zack Barresse

Super Moderator
Staff member
Joined
Mar 16, 2011
Messages
112
Reaction score
0
Points
0
Location
Oregon, United States
Excel Version(s)
365, Online, iOS, iOS for iPad
So when going up with the spin button, 1 would equal column B? So 2 would equal column C, etc? And when this is increased, what would you want done with the format of the previous column? For example, if you changed the spinner from 1 to 2, what would be done with the format of column B? Just left there?

Also, when going down with the spinner button, let's say you were up to column D (3?), when you clicked the down arrow, what should be done with the formats of column D? Should all formats be removed, or just certain formats?
 
Top