Results 1 to 4 of 4

Thread: How to copy format of a column using spin button

  1. #1

    Lightbulb How to copy format of a column using spin button



    Register for a FREE account, and/
    or Log in to avoid these ads!

    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:
    Private Sub SpinButton1_SpinUp()
    
    Columns("A").Select
    Selection.Copy
    Columns("C").Select
    
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    
    End Sub
    Last edited by Zack Barresse; 2014-03-06 at 08:39 PM. Reason: Added CODE tags

  2. #2
    Super Moderator Zack Barresse's Avatar
    Join Date
    Mar 2011
    Location
    Oregon, United States
    Posts
    106
    Articles
    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.
    Regards,
    Zack Barresse

  3. #3
    Quote Originally Posted by Zack Barresse View Post
    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.

  4. #4
    Super Moderator Zack Barresse's Avatar
    Join Date
    Mar 2011
    Location
    Oregon, United States
    Posts
    106
    Articles
    0
    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?
    Regards,
    Zack Barresse

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •