Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need help With Code:
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 14 here's my current code: Sub Macro1() Application.DisplayAlerts = False 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").Select Selection.Copy Windows("DAILY OPERATIONS_2004.xls").Activate Range("C9").Select ActiveSheet.Paste Range("E9").Select Windows("1.TXT").Activate Range("F14").Select Application.CutCopyMode = False Selection.Copy Windows("DAILY OPERATIONS_2004.xls").Activate ActiveSheet.Paste Range("J9").Select Windows("1.TXT").Activate Range("E17").Select Application.CutCopyMode = False Selection.Copy Windows("DAILY OPERATIONS_2004.xls").Activate ActiveSheet.Paste Range("K9").Select Windows("1.TXT").Activate Range("G18").Select Application.CutCopyMode = False Selection.Copy Windows("DAILY OPERATIONS_2004.xls").Activate ActiveSheet.Paste ActiveWindow.LargeScroll ToRight:=2 Range("AI9").Select Windows("1.TXT").Activate Range("F18").Select Application.CutCopyMode = False Selection.Copy Windows("DAILY OPERATIONS_2004.xls").Activate ActiveSheet.Paste Windows("1.TXT").Activate ActiveWindow.Close Application.DisplayAlerts = True End Su -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Code to conditional format all black after date specified in code? | Excel Discussion (Misc queries) | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
copying vba code to a standard code module | Excel Discussion (Misc queries) | |||
VBA code delete code but ask for password and unlock VBA protection | Excel Programming |