Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to check a cell for content before running macro.
I have some raw data that is not delimited. I want to use a macro to delimit it and then remove a column. I have recorded a macro to do this: Sub delimit_raw_data() ' ' delimit_raw_data Macro ' Macro recorded 7/10/2005 by Incoherent ' ' Columns("A:A").Select Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _ TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, _ Semicolon:=False, Comma:=False, Space:=True, Other:=True, 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("A27").Select Range(Selection, Selection.End(xlDown)).Select Selection.Delete Shift:=xlToLeft Range("E24").Select End Sub What I need to happen is for the macro to check one of the cells to see if there is data there, if there is, DO NOT run the rest of the macro and put up a message saying "data already delimited you idiot, quitting" or something similar. I am VB imbecile. Thanks Incoherent |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to check a cell for content before running macro.
Sub delimit_raw_data()
' ' delimit_raw_data Macro ' Macro recorded 7/10/2005 by Incoherent ' ' If not isempty(Range("B9")) then msgbox "Data already delimited, hit key to quit",vbOk exit Sub End if Columns("A:A").Select Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _ TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, _ Semicolon:=False, Comma:=False, Space:=True, Other:=True, 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("A27").Select Range(Selection, Selection.End(xlDown)).Select Selection.Delete Shift:=xlToLeft Range("E24").Select End Sub "Incoherent" wrote in message ... I have some raw data that is not delimited. I want to use a macro to delimit it and then remove a column. I have recorded a macro to do this: Sub delimit_raw_data() ' ' delimit_raw_data Macro ' Macro recorded 7/10/2005 by Incoherent ' ' Columns("A:A").Select Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _ TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, _ Semicolon:=False, Comma:=False, Space:=True, Other:=True, 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("A27").Select Range(Selection, Selection.End(xlDown)).Select Selection.Delete Shift:=xlToLeft Range("E24").Select End Sub What I need to happen is for the macro to check one of the cells to see if there is data there, if there is, DO NOT run the rest of the macro and put up a message saying "data already delimited you idiot, quitting" or something similar. I am VB imbecile. Thanks Incoherent |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Check if content in cell is an integer | New Users to Excel | |||
Check if content in cell is an integer | New Users to Excel | |||
Clearing Check Boxes & Running a diff Macro when unchecking the ch | Excel Discussion (Misc queries) | |||
how : check register running balance is a stationary cell | Excel Discussion (Misc queries) | |||
Check cell for data before running code | Excel Programming |