LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default If statement question

I wonder if you can help me to solve this matter.
I have a program which open an exiten "lst" and "dat" file en excel ( see
below). To open these files properly, the macro has the delimite setup
automatically for each case "lst" and "dat" files respectivelly.
However, I am using two different macros to open these files . I would to
open them with one macro only. I would like to know what "if statement" do I
have to use to in order to combine them in one macro only.

Thanks in advcance.
Maperalia



'%%%%%%%%%%%%%%%%%%%%%%%%%
Sub Open_dat_File()

Application.ScreenUpdating = False

'WO = Application.InputBox("Enter Work Order Number")
WO = Worksheets("DEFAULTS").Range("C3")

Directory = "S:\GEOTEST\shears\" & WO & "\"
filetext = Selection.Value
Workbooks.Open Directory & filetext

Application.ScreenUpdating = False


Columns("A:A").EntireColumn.AutoFit
Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False,
Tab:=False, _
Semicolon:=False, Comma:=True, Space:=False, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5,
1), Array(6, 1)), _
TrailingMinusNumbers:=True
Columns("A:F").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A2:B2").Select
Selection.Cut Destination:=Range("B1:C1")
Range("C2:F2").Select
Selection.Cut Destination:=Range("A2:D2")
Columns("D:D").Select
Selection.Cut Destination:=Columns("F:F")
Columns("A:A").Select
Selection.Cut Destination:=Columns("D:D")
Columns("F:F").Select
Selection.Cut Destination:=Columns("A:A")
Range("C2").Select
End Sub
'%%%%%%%%%%%%%%%%%%%%%%%%%


'$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $
Sub Open_lst_File()

Application.ScreenUpdating = False

'WO = Application.InputBox("Enter Work Order Number")
WO = Worksheets("DEFAULTS").Range("C3")

Directory = "S:\GEOTEST\shears\" & WO & "\"
filetext = Selection.Value
Workbooks.Open Directory & filetext

Application.ScreenUpdating = False

Columns("A:A").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5,
1), Array(6, 1), _
Array(7, 1), Array(8, 1), Array(9, 1)), TrailingMinusNumbers:=True
Range("B2").Select
End Sub

'$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $




 
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
IF Statement question peg84 Excel Discussion (Misc queries) 3 February 4th 08 10:19 PM
IF statement question KarenH Excel Worksheet Functions 5 June 23rd 06 09:17 PM
If statement question dlb[_4_] Excel Programming 5 February 17th 06 05:14 PM
If Statement Question redwings04 Excel Worksheet Functions 4 July 4th 05 09:42 PM
IF Statement question Patrick Simonds Excel Worksheet Functions 7 May 8th 05 04:03 PM


All times are GMT +1. The time now is 01:38 AM.

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

About Us

"It's about Microsoft Excel"