Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default ISNULL( ) or something else...

I am having trouble making my macro run properly. The problem is happening
around the area with "!!!"

Public Sub assign()
Worksheets("Sheet3").Activate
Dim xnode As Long
Dim zrow As Long
zrow = 2
xnode = 1
Do While Range("B" & zrow).Value < 0
Range("A" & zrow).Value = xnode
xnode = xnode + 1
If Range("E" & zrow).Value < 0 Then
Range("D" & zrow).Value = xnode
xnode = xnode + 1
End If
' !!!
If Range("I" & zrow).Value < 0 Then
Range("H" & zrow).Value = xnode
xnode = xnode + 1
End If
' !!!

zrow = zrow + 1
Loop
End Sub

I am wanting it to put variable xnode into column H at row zrow. However, I
only want it to do this IF the cell in column I row zrow is not empty.

The result is that a value is put into H regardless of whether I has any
values in it or not.

Please help. Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default ISNULL( ) or something else...

Have you tried

If Range("I" & zrow).Value < "" Then

or

If IsEmpty(Range("I" & zrow).Value) Then

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Shane" wrote in message
...
I am having trouble making my macro run properly. The problem is

happening
around the area with "!!!"

Public Sub assign()
Worksheets("Sheet3").Activate
Dim xnode As Long
Dim zrow As Long
zrow = 2
xnode = 1
Do While Range("B" & zrow).Value < 0
Range("A" & zrow).Value = xnode
xnode = xnode + 1
If Range("E" & zrow).Value < 0 Then
Range("D" & zrow).Value = xnode
xnode = xnode + 1
End If
' !!!
If Range("I" & zrow).Value < 0 Then
Range("H" & zrow).Value = xnode
xnode = xnode + 1
End If
' !!!

zrow = zrow + 1
Loop
End Sub

I am wanting it to put variable xnode into column H at row zrow. However,

I
only want it to do this IF the cell in column I row zrow is not empty.

The result is that a value is put into H regardless of whether I has any
values in it or not.

Please help. Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default ISNULL( ) or something else...

Change this line ...

If Range("I" & zrow).Value < 0 Then

... to this ...

If Range("I" & zrow).Value < "" Then

HTH

--
Regards,
Zack Barresse, aka firefytr, (GT = TFS FF Zack)



"Shane" wrote in message
...
I am having trouble making my macro run properly. The problem is happening
around the area with "!!!"

Public Sub assign()
Worksheets("Sheet3").Activate
Dim xnode As Long
Dim zrow As Long
zrow = 2
xnode = 1
Do While Range("B" & zrow).Value < 0
Range("A" & zrow).Value = xnode
xnode = xnode + 1
If Range("E" & zrow).Value < 0 Then
Range("D" & zrow).Value = xnode
xnode = xnode + 1
End If
' !!!
If Range("I" & zrow).Value < 0 Then
Range("H" & zrow).Value = xnode
xnode = xnode + 1
End If
' !!!

zrow = zrow + 1
Loop
End Sub

I am wanting it to put variable xnode into column H at row zrow. However,
I
only want it to do this IF the cell in column I row zrow is not empty.

The result is that a value is put into H regardless of whether I has any
values in it or not.

Please help. Thanks.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default ISNULL( ) or something else...

Just to add to the excellent suggestions

If the change is

If Range("I" & zrow).Text < "" Then

then it should work in xl97 as well although I can think of some other
drawbacks - but they should be rare

another would be

If Not IsEmpty(Range("I" & zrow)) then



--
Regards,
Tom Ogilvy

"Zack Barresse" wrote in message
...
Change this line ...

If Range("I" & zrow).Value < 0 Then

.. to this ...

If Range("I" & zrow).Value < "" Then

HTH

--
Regards,
Zack Barresse, aka firefytr, (GT = TFS FF Zack)



"Shane" wrote in message
...
I am having trouble making my macro run properly. The problem is

happening
around the area with "!!!"

Public Sub assign()
Worksheets("Sheet3").Activate
Dim xnode As Long
Dim zrow As Long
zrow = 2
xnode = 1
Do While Range("B" & zrow).Value < 0
Range("A" & zrow).Value = xnode
xnode = xnode + 1
If Range("E" & zrow).Value < 0 Then
Range("D" & zrow).Value = xnode
xnode = xnode + 1
End If
' !!!
If Range("I" & zrow).Value < 0 Then
Range("H" & zrow).Value = xnode
xnode = xnode + 1
End If
' !!!

zrow = zrow + 1
Loop
End Sub

I am wanting it to put variable xnode into column H at row zrow.

However,
I
only want it to do this IF the cell in column I row zrow is not empty.

The result is that a value is put into H regardless of whether I has any
values in it or not.

Please help. Thanks.





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default ISNULL( ) or something else...

Thank you for the help. I tried another similiar method shortly after
posting. I changed the "0" to Empty. It works now. Thanks!

"Tom Ogilvy" wrote:

Just to add to the excellent suggestions

If the change is

If Range("I" & zrow).Text < "" Then

then it should work in xl97 as well although I can think of some other
drawbacks - but they should be rare

another would be

If Not IsEmpty(Range("I" & zrow)) then



--
Regards,
Tom Ogilvy

"Zack Barresse" wrote in message
...
Change this line ...

If Range("I" & zrow).Value < 0 Then

.. to this ...

If Range("I" & zrow).Value < "" Then

HTH

--
Regards,
Zack Barresse, aka firefytr, (GT = TFS FF Zack)



"Shane" wrote in message
...
I am having trouble making my macro run properly. The problem is

happening
around the area with "!!!"

Public Sub assign()
Worksheets("Sheet3").Activate
Dim xnode As Long
Dim zrow As Long
zrow = 2
xnode = 1
Do While Range("B" & zrow).Value < 0
Range("A" & zrow).Value = xnode
xnode = xnode + 1
If Range("E" & zrow).Value < 0 Then
Range("D" & zrow).Value = xnode
xnode = xnode + 1
End If
' !!!
If Range("I" & zrow).Value < 0 Then
Range("H" & zrow).Value = xnode
xnode = xnode + 1
End If
' !!!

zrow = zrow + 1
Loop
End Sub

I am wanting it to put variable xnode into column H at row zrow.

However,
I
only want it to do this IF the cell in column I row zrow is not empty.

The result is that a value is put into H regardless of whether I has any
values in it or not.

Please help. Thanks.






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
Test for null - insert a row if isnull Bonnie Excel Discussion (Misc queries) 3 July 10th 07 09:20 PM
Curious IsNull test Tim[_44_] Excel Programming 4 August 31st 05 08:19 PM
problem using isnull() to check a value in ADODB.Recordset tilmP Excel Programming 0 January 18th 05 07:42 AM
ISNULL function - can't find it KitKat Excel Worksheet Functions 6 December 3rd 04 04:55 AM


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