Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default find the next empty cell: expanded


I'm trying to tell good 'ole Excel to start at B3, then go down the
column and find the next row with the value of "Address" in column B
WITH an empty cell next to it in Column C. In other words, I've got a
data entry userform, and I'm trying to located the next empty form
(they all start with "Address").

I'm aware that the following code will find the next empty cell:

Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True


So I'm trying to do something like this:

If ActiveCell = "Address" And ActiveCell.Offset(0, 1) Is Not Null Then
ActiveCell.Offset(1, 0).Select
End If
ActiveCell = "Address" And ActiveCell.Offset(0, 1) Is Null

But that's nowhere near correct i guess. Any ideas?


--
stew0720
------------------------------------------------------------------------
stew0720's Profile: http://www.excelforum.com/member.php...o&userid=35687
View this thread: http://www.excelforum.com/showthread...hreadid=554741

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default find the next empty cell: expanded

Sub opse()
Set r = ActiveSheet.UsedRange
nLastRow = r.Rows.Count + r.Row - 1

For i = 3 To nLastRow
If Cells(i, 2).Value = "Address" Then
If IsEmpty(Cells(i, 3).Value) Then
Exit For
End If
End If
Next
MsgBox (i)
End Sub


--
Gary's Student


"stew0720" wrote:


I'm trying to tell good 'ole Excel to start at B3, then go down the
column and find the next row with the value of "Address" in column B
WITH an empty cell next to it in Column C. In other words, I've got a
data entry userform, and I'm trying to located the next empty form
(they all start with "Address").

I'm aware that the following code will find the next empty cell:

Do
If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True


So I'm trying to do something like this:

If ActiveCell = "Address" And ActiveCell.Offset(0, 1) Is Not Null Then
ActiveCell.Offset(1, 0).Select
End If
ActiveCell = "Address" And ActiveCell.Offset(0, 1) Is Null

But that's nowhere near correct i guess. Any ideas?


--
stew0720
------------------------------------------------------------------------
stew0720's Profile: http://www.excelforum.com/member.php...o&userid=35687
View this thread: http://www.excelforum.com/showthread...hreadid=554741


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default find the next empty cell: expanded


thanks very much for your help. i'm definitely a BEGINNER, and any help
is greatly appreaciated.

so how would that apply to the following code? what else would i need
to add/initialize etc? in other words, how can i add that to this code
to make it work?

thanks!!

Private Sub cmdCancel_Click()

Unload Me


End Sub

Private Sub cmdClearForm_Click()
Call UserForm_Initialize
End Sub

Private Sub cmdOK_Click()
ActiveWorkbook.Sheets("Rough-In Schedule").Activate

Range("C3").Select


Do

If IsEmpty(ActiveCell) = False Then
ActiveCell.Offset(1, 0).Select
End If
Loop Until IsEmpty(ActiveCell) = True



ActiveCell.Value = txtAddress.Value

ActiveCell.Offset(1, 0) = txtCity.Value

ActiveCell.Offset(2, 0) = cboBuilder.Value

ActiveCell.Offset(3, 0) = txtSuperintendent.Value

ActiveCell.Offset(4, 0) = txtPlanNumber.Value

ActiveCell.Offset(5, 0) = txtEnteredBy.Value



ActiveCell.Offset(7, 0) = Calendar2.Value

ActiveCell.Offset(8, 0) = txtMapsco.Value

ActiveCell.Offset(6, 0) = Calendar1.Value


If optDallas = True Then

ActiveCell.Offset(9, 0).Value = "Dallas"

ElseIf optFtWorth = True Then

ActiveCell.Offset(9, 0).Value = "FortWorth"

End If


If optGas = True Then

ActiveCell.Offset(10, 0).Value = "Gas"


ElseIf optElectric = True Then

ActiveCell.Offset(10, 0).Value = "Electric"

End If

Range("C3").Select

End Sub

Private Sub UserForm_Initialize()


txtAddress.Value = " "

txtCity.Value = " "


txtSuperintendent.Value = " "

txtPlanNumber.Value = " "

txtEnteredBy.Value = " "

txtMapsco.Value = " "

With cboBuilder

..AddItem "HORTON"

..AddItem "ASHTON WOODS"

..AddItem "WEEKLEY"

..AddItem "TOLL BROTHERS"

..AddItem "LAND STAR"

..AddItem "DREES"

..AddItem "MORRISON"

..AddItem "GRAHAM HART"

..AddItem "GRAND"

..AddItem "REIG/STONE BROOK"

..AddItem "OUTBACK"

End With

cboBuilder.Value = " "

optDallas = True

optFtWorth = False
optGas = True
optElectric = False


txtAddress.SetFocus

End Sub










optDallas = True

optFtWorth = False
optGas = True
optElectric = False


txtAddress.SetFocus

End Sub


--
stew0720
------------------------------------------------------------------------
stew0720's Profile: http://www.excelforum.com/member.php...o&userid=35687
View this thread: http://www.excelforum.com/showthread...hreadid=554741

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
find last none empty cell kevcar40 Excel Discussion (Misc queries) 3 March 1st 06 11:59 AM
To find empty cell Asu Excel Programming 3 December 3rd 05 05:44 PM
Find Empty Cell in Row Steve C Excel Programming 2 November 20th 05 01:55 AM
Find 1st Empty Cell: How to? Chris Excel Programming 4 December 2nd 03 09:41 PM
Find Empty Cell Wally Steadman[_3_] Excel Programming 3 November 23rd 03 10:50 PM


All times are GMT +1. The time now is 07:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"