ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Can anyone help, with a formla (https://www.excelbanter.com/excel-worksheet-functions/110763-can-anyone-help-formla.html)

Janine

Can anyone help, with a formla
 
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


Bob Phillips

Can anyone help, with a formla
 
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)

"Janine" wrote in message
oups.com...
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





All times are GMT +1. The time now is 01:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com