Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
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
Check if content in cell is an integer prem New Users to Excel 6 May 1st 08 01:54 PM
Check if content in cell is an integer Mike H New Users to Excel 0 May 1st 08 09:53 AM
Clearing Check Boxes & Running a diff Macro when unchecking the ch Vick Excel Discussion (Misc queries) 6 May 30th 07 08:44 PM
how : check register running balance is a stationary cell Michele Excel Discussion (Misc queries) 9 January 19th 05 05:25 PM
Check cell for data before running code Pat Excel Programming 1 January 12th 05 08:58 PM


All times are GMT +1. The time now is 04:15 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"