View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
JayKay100 JayKay100 is offline
external usenet poster
 
Posts: 6
Default How to delete a row if strong NOT found....

When I try to run the macro it immediately takes me back in the VBA with a
box that says
€śCompile error
Syntax Error€ť

Then where it says "Sub CreateNewWorkbook()" is in yellow and where it says
"searchColumn = Trim(InputBox("Enter columnu to search in:", "Search Column"
is in red.

Also this is in red "newFileName = Trim(InputBox("Enter Name for the new
file:", "New File"
Name", ""))

I hope this helps€¦. I also hope I am not doing something wrong€¦. Lol

My security level is set to €śLOW€ť - I have tried running on two machines,
one is xp and one is vista.... results are the same

Also, I have ran other macros on both machines in the past so I don't think
it is a machine problem but, of course, I am really not qualified to make
that decision.


Best Regards,
Jim


"JLatham" wrote:

Make certain that Macro Security (Tools | macro | Security in 2003 and
earlier) is set to Medium. It may be set on High or Very High which would
keep the macro from running and not offer you the opportunity to [Enable]
macros.

As for the Trim function - Trim() removes leading and trailing white-space
from a text entry. So we remove it from the input you provide for a column
ID letter (or letters) since column letters don't have spaces before/after
them. And that entry (in which I misspelled column as columnu) is looking
for an entry like "A" or "Z" or "AB", not a title in a column row.

I don't remove any white-space from the search text because you may want to
enter something like (without " marks) " toyota " to catch only entries where
toyota is a whole word and not part of something like " ToyotasAreUs".

You say it's gagging - is it throwing up any error messages or just not
running at all? since the first executable line is the 'searchString =
InputBox("...' line of code either you should get an error there, or you
should get a kind of message box with an input area for you to type into. If
you're not getting that, then I suspect macro execution is turned off, and
the suggestion in my first paragraph should help.

NOTE: once you change the Macro Security level, you have to close and then
reopen Excel for the changes to take effect.

Hope this helps.

"JayKay100" wrote:

Evenf with my dismal lack of macro "Smarts" I can tell that we are on the
right track but the macro seems to gag on these entries. (It does not get to
the point where it asks me for any input......)

searchString = InputBox("Enter text to find:", "Search Text Entry", "")
If Trim(searchString) = "" Then
Exit Sub
End If
searchColumn = Trim(InputBox("Enter columnu to search in:", "Search Column
Entry ", ""))"
If searchColumn = "" Then
Exit Sub

Should not the searchString and searchColumn entries look almost identical?
I notice one says trim(input box( and the other does not and some other small
differences. Maybe it doesnt make any difference but I am afraid to make any
changes.

Jim