VBA Macro to paste the values with row and column alignment automatically.
Results 1 to 2 of 2

Thread: VBA Macro to paste the values with row and column alignment automatically.
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Aug 2017
    Posts
    21
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default VBA Macro to paste the values with row and column alignment automatically.

    HI Everyone,

    I need a macro to align my results in same sheet according to last maximum used rows from multiple columns.

    I have given image link that how am expecting result that will give exact idea.

    Please check and do the needful your support will be very helpful for me.

    Image link given below.

    https://ibb.co/vcQTVQB----> Actual result.
    https://ibb.co/pzkvcHB----> expected result



    Here is my current code.

    Code:
    Sheets("Sheet1").Select
    Columns("AA:AA").Select
    Selection.AutoFilter
    ActiveSheet.Range("$AA$1:$AA$200000").AutoFilter Field:=1, Criteria1:= _
    "=< fruit**", operator:="xlAnd
    Range(" aa2").select
       Range(Selection, Selection.End(xlDown)).Select
    Selection.Font.Bold = True
    With Selection.Font
    .ThemeColor = xlThemeColorAccent1
    .TintAndShade = 0.799981688894314
    End With
    Selection.AutoFilter
    Columns("AA:AA").Select
    Selection.AutoFilter
    ActiveSheet.Range("$AA$1:$AA$200000").AutoFilter Field:=1, Criteria1:= _
    "=**", Operator:=xlAnd
    Range("AA2").Select
    Range(Selection, Selection.End(xlDown)).Select
    With Selection.Font
    .ThemeColor = xlThemeColorAccent1
    .TintAndShade = 0
    End With
    Selection.AutoFilter
    Columns("AA:AA").Select
    Selection.AutoFilter
    ActiveSheet.Range("$AA$1:$AA$200000").AutoFilter Field:=1, Criteria1:=RGB(68, 114, 196), Operator:=xlFilterFontColor
    Range("AA2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial
    Sheets("Sheet1").Select
    Selection.AutoFilter
    Columns("AA:AA").Select
    With Selection.Font
    .ThemeColor = xlThemeColorLight1
    .TintAndShade = 0
    End With
    Last edited by Fluff; Aug 11th, 2019 at 01:18 PM.
    0 0
     

  2. #2
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    26,897
    Post Thanks / Like
    Mentioned
    459 Post(s)
    Tagged
    45 Thread(s)

    Default Re: VBA Macro to paste the values with row and column alignment automatically.

    Duplicate https://www.mrexcel.com/forum/excel-...e-columns.html

    Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread.
    Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10
    0 0
     

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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