View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
acw[_2_] acw[_2_] is offline
external usenet poster
 
Posts: 100
Default Need help With Code:

H

The macro below will search for DEV in column A. If it is not found, then it will insert a row above A15

HT

Ton

Sub aaa(
If Range("a:a").Find(what:="DEV") Is Nothing The
Range("a15").EntireRow.Insert shift:=xlDow
End I
End Su

----- alexm999 wrote: ----

through a Macro, i am importing a Text file and am taking data fro
certain cells in that text files and pasting them into cells of anothe
excel file.
I am running into an error, sometimes the Text file doesnt generate
specific row of data that starts with DEV

I'd like the code to do the following
If Column A has a row that starts off with the word DEV, then dont d
anything and continue running the script
If Column A has NO row that starts off with the word DEV, then add
blank row after row 1

here's my current code
Sub Macro1(
Application.DisplayAlerts = Fals
Workbooks.OpenText Filename:="E:\UDC\1.TXT", Origin:=xlWindows
StartRow
:=7, 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)
Range("F13").Selec
Selection.Cop
Windows("DAILY OPERATIONS_2004.xls").Activat
Range("C9").Selec
ActiveSheet.Past
Range("E9").Selec
Windows("1.TXT").Activat
Range("F14").Selec
Application.CutCopyMode = Fals
Selection.Cop
Windows("DAILY OPERATIONS_2004.xls").Activat
ActiveSheet.Past
Range("J9").Selec
Windows("1.TXT").Activat
Range("E17").Selec
Application.CutCopyMode = Fals
Selection.Cop
Windows("DAILY OPERATIONS_2004.xls").Activat
ActiveSheet.Past
Range("K9").Selec
Windows("1.TXT").Activat
Range("G18").Selec
Application.CutCopyMode = Fals
Selection.Cop
Windows("DAILY OPERATIONS_2004.xls").Activat
ActiveSheet.Past
ActiveWindow.LargeScroll ToRight:=
Range("AI9").Selec
Windows("1.TXT").Activat
Range("F18").Selec
Application.CutCopyMode = Fals
Selection.Cop
Windows("DAILY OPERATIONS_2004.xls").Activat
ActiveSheet.Past
Windows("1.TXT").Activat
ActiveWindow.Clos
Application.DisplayAlerts = Tru
End Su


--
Message posted from http://www.ExcelForum.com