How to show a specific column

Closed
ashish.neharkar Posts 1 Registration date Monday January 16, 2017 Status Member Last seen January 16, 2017 - Jan 16, 2017 at 12:56 AM
vcoolio Posts 1404 Registration date Thursday July 24, 2014 Status Moderator Last seen September 15, 2023 - Jan 16, 2017 at 05:52 AM
sir i want show only a specific column on another sheet.for example i have A-Z column with data and i want to print only specific column means show data only A,H,S,T,V to another sheet .how can i sir? plz help me.
Related:

1 response

vcoolio Posts 1404 Registration date Thursday July 24, 2014 Status Moderator Last seen September 15, 2023 259
Jan 16, 2017 at 05:52 AM
Hello Ashish,

See if the following code does the task for you:-

Option Explicit

Sub MoveCols()

    Dim ar As Variant
    Dim var As Variant
    Dim ws As Worksheet, ws1 As Worksheet

Set ws = Sheet1
Set ws1 = Sheet2

ar = ws.Range("A1", ws.Range("Z" & Rows.Count).End(xlUp))
  var = Application.Index(ar, Evaluate("row(1:" & ws.[A1].CurrentRegion.Rows.Count & ")"), Array(1, 8, 19, 20, 22))
    ws1.Range("A1:E" & UBound(var)) = var

End Sub


I have created a sample work book for you to peruse at the following link:-

https://www.dropbox.com/s/s1433antvvflgkl/Move%20selected%20columns%20to%20sht2..xlsm?dl=0

There is a red button just after Column Z. Click on the button and then check sheet2 to see if the correct columns have been copied over.

I hope that this helps.

Cheerio,
vcoolio.
0