Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel VBA - Help!

Status
Not open for further replies.

dreameR25

Programmer
Aug 5, 2002
35
US
Hi all,

I am completely new to VBA and I need to do the following task pretty urgently.

A spreadsheet called Work containing columns A, B, C, D and E.

I need to reformat the spreadsheet so that only columns B, C and E remain. I know I can delete the columns but I want some sort of utility that would allow me to enter the column headings that I want to keep, press a start button and the VBA would remove the columns from the spreadsheet.

Any suggestions?
 
I'm also new to VBA, but I recorded this macro which may give uou a clue.

Good luck,
Henio

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 24/07/2003
'

'
Columns("A:A").Select
Selection.EntireColumn.Hidden = True
Columns("D:D").Select
Selection.EntireColumn.Hidden = True
Columns("G:H").Select
Selection.EntireColumn.Hidden = True
End Sub
 
I want to delete them.

Here is what I am trying to achieve :

Suppose I have two datasheets. The first one will hold a column called Datasheet. The second column will hold the Column Headings to keep.

In the second datasheet the real data resides where we have our columns A, B, C, D and E.

The idea is that I want to be able to go to the first sheet. Enter the name of the target datasheet, specify the column I want to keep in the other one and press a star button. This would create a new datasheet with only the columns specified not the whole lot.

I have no idea how to work with Ranges etc.

Thanks in advance for your help.
 
this should be quite easy can u specify the column letter where u put the columns heading you want to see also the sheet names...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top