Can anyone help, with a formla

J

Janine

Hi,

I have a code, obviously! anyway i am trying to run it but i keep
coming back with compile error sub or functions not defined.

Here is the code
Sub Start()
abort_op = False
'Sheets(1).Activate
Application.StatusBar = ""
UserForm2.Show
Application.Wait Now + TimeValue("00:00:02")
Sheets(1).Select
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

Dim LR As Long
Dim LC As Long
Dim i As Long
Dim Rw As Long
Sheets(1).Range("B2", Range("B65536").End(xlUp)).Select
Rw = Selection.Rows.Count 'Determine last used Row in column
For i = 2 To (Rw + 1)
Sheets(1).Select
Application.StatusBar = "Checking for existing Clients and Creating
New Client Sheets "
ROWNO = i
If Cells(i, 2).Value <> vbNullString Then
Cells(i, 2).Value = Replace(Cells(i, 2).Value, "/", "_")
Checksheet = Cells(i, 2).Value
Call AddSheetWithNameCheckIfExists
Else
End If
Application.StatusBar = "Checking for existing Clients and Creating
New Client Sheets " & i & " of " & Rw + 1
Next i

When i debug the formula it highlights replace and now i am stuck! If
anyone can help pleas let me know.

thank you Janine
 
B

Bob Phillips

I cannot reproduce the problem, but why would you try and replace anything
in a cell just after having ascertained it is a null value there?

Also vbNullstring is really meant to call external procedures, not to use
like that, I always use

If IsEmpty( Cells(i, 2).Value) Then

or

If Cells(i, 2).Value = "" Then

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top