Small change

PIsabel

Board Regular
Joined
Feb 4, 2014
Messages
126
Office Version
  1. 365
Platform
  1. Windows
Hello
I have this code that works very well.
It runs in column E to the last occupied cell of Column J.
Now I need a new code that does the same but runs only on cells in column E if they have information and if column J on the same line has no information

Thanks
Isabel



Code:
Sub no_more_ND()
    Dim c As Range
    For Each c In Range("E1:E" & Range("J" & Rows.Count).End(xlUp).Row)
        c.Select
        Application.SendKeys "{F2}"
        Application.SendKeys "{ENTER}"
        DoEvents
    Next c
    
End Sub
 
Last edited:

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hi PIsabel - You might try something like the following If statement.

Code:
Sub PIsabel()
For Each c In Range("E1:E10")
'If E not equal to nothing and J = nothing Then
    If c.Value <> "" And c.Offset(0, 5).Value = "" Then
        c.Value = 5 'Do something here - example sets value to 5
    End If
Next c
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,148
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top