Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Traci
 
Posts: n/a
Default Macro wiping out worksheet

I've built a macro to perform some general formatting. The only catch is
that this spreadsheet is an export from a web based application. The headers
export as hyperlinks, so I have converted those headers to text PRIOR to
running the macro.

I've included the code from the macro here. Does anyone see any reason why
all the data seems to disappear from the spreadsheet when the macro
completes? It's like you highlighted all the columns and deleted them. The
title bar still shows that I am in the correct spreadsheet.

Sub Traci()
'
' Traci Macro
' Macro recorded 5/18/2006 by TReavis
'
' Keyboard Shortcut: Ctrl+b
'
Columns("H:K").Select
Selection.Delete Shift:=xlToLeft
Columns("C:D").Select
Selection.Delete Shift:=xlToLeft
Cells.Select
With Selection
.VerticalAlignment = xlBottom
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("H19").Select
ActiveWorkbook.Save
ActiveWindow.WindowState = xlNormal
ActiveWindow.WindowState = xlMaximized
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Don Guillett
 
Posts: n/a
Default Macro wiping out worksheet

When I run yours or this I get a,b,e,f,g columns left. Notice NO selections.
You probably don't want ALL of the cells and you probably only want to
unmerge the cells?

Sub deletecolumns()
Columns("H:k").Delete
Columns("c:d").Delete
With Cells 'probably only want merge cells
.VerticalAlignment = xlBottom
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
End Sub

--
Don Guillett
SalesAid Software

"Traci" wrote in message
...
I've built a macro to perform some general formatting. The only catch is
that this spreadsheet is an export from a web based application. The
headers
export as hyperlinks, so I have converted those headers to text PRIOR to
running the macro.

I've included the code from the macro here. Does anyone see any reason
why
all the data seems to disappear from the spreadsheet when the macro
completes? It's like you highlighted all the columns and deleted them.
The
title bar still shows that I am in the correct spreadsheet.

Sub Traci()
'
' Traci Macro
' Macro recorded 5/18/2006 by TReavis
'
' Keyboard Shortcut: Ctrl+b
'
Columns("H:K").Select
Selection.Delete Shift:=xlToLeft
Columns("C:D").Select
Selection.Delete Shift:=xlToLeft
Cells.Select
With Selection
.VerticalAlignment = xlBottom
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("H19").Select
ActiveWorkbook.Save
ActiveWindow.WindowState = xlNormal
ActiveWindow.WindowState = xlMaximized
End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
I need help with a macro which will copy a worksheet and.. Greegan Excel Worksheet Functions 2 July 29th 05 11:48 PM
macro to copy and edit then delete a worksheet lschuh Excel Discussion (Misc queries) 13 July 27th 05 09:02 PM
macro help thephoenix12 Excel Discussion (Misc queries) 4 July 15th 05 05:57 PM
Executing macro for all worksheet from a different worksheet Biti New Users to Excel 3 December 8th 04 10:05 AM


All times are GMT +1. The time now is 04:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"