Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Finding blank cell


Code:
--------------------
Private Sub CommandButton2_Click()

Dim i As Integer
Dim PurchaseID As String

If Sheets(1).Range("B1").Value = "" Then
MsgBox "Please enter a Member ID into highlighted cell B1", vbOKOnly, "Enter Member ID"
Exit Sub

Else

i = 1
Do Until PurchaseID = ""
PurchaseID = Sheets(3).Range("A" & i).Value
i = i + 1
Loop

Sheets(3).Range("A" & i + 1).Value = i

End If
End Sub
--------------------


I currently have this code, but first let me explain the situation.

On sheet1 there is are two command buttons, the first is fine but this
second one will function to do something else.

The code I have posted above is that of the second button. In sheet 1
I have the user enter some simple data, but I want some of this data to
be retained and logged into sheet3.

What I need to do is work out where the next blank row is in sheet3,
but the code above isn't working - all it does everytime is return the
second row - even though there is something in the second row.


--
Mario_Party
------------------------------------------------------------------------
Mario_Party's Profile: http://www.excelforum.com/member.php...o&userid=30925
View this thread: http://www.excelforum.com/showthread...hreadid=506008

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Finding blank cell

I like to look at the bottom of a column (it looks like you could use column A)
and come up to the last used cell. The come down one cell.

Dim NextCell as range

with worksheets(3)
set nextcell = .cells(.rows.count,"A").end(xlup).offset(1,0)
end with

Then I can use that however I want--copy|Paste or just assign values.

nextcell.value = ....

somerange.copy _
destination:=nextcell




Mario_Party wrote:

Code:
--------------------
Private Sub CommandButton2_Click()

Dim i As Integer
Dim PurchaseID As String

If Sheets(1).Range("B1").Value = "" Then
MsgBox "Please enter a Member ID into highlighted cell B1", vbOKOnly, "Enter Member ID"
Exit Sub

Else

i = 1
Do Until PurchaseID = ""
PurchaseID = Sheets(3).Range("A" & i).Value
i = i + 1
Loop

Sheets(3).Range("A" & i + 1).Value = i

End If
End Sub
--------------------

I currently have this code, but first let me explain the situation.

On sheet1 there is are two command buttons, the first is fine but this
second one will function to do something else.

The code I have posted above is that of the second button. In sheet 1
I have the user enter some simple data, but I want some of this data to
be retained and logged into sheet3.

What I need to do is work out where the next blank row is in sheet3,
but the code above isn't working - all it does everytime is return the
second row - even though there is something in the second row.

--
Mario_Party
------------------------------------------------------------------------
Mario_Party's Profile: http://www.excelforum.com/member.php...o&userid=30925
View this thread: http://www.excelforum.com/showthread...hreadid=506008


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Finding blank cell


I do not understand, please help

--
Mario_Part
-----------------------------------------------------------------------
Mario_Party's Profile: http://www.excelforum.com/member.php...fo&userid=3092
View this thread: http://www.excelforum.com/showthread.php?threadid=50600

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Finding blank cell

What part?

Mario_Party wrote:

I do not understand, please help.

--
Mario_Party
------------------------------------------------------------------------
Mario_Party's Profile: http://www.excelforum.com/member.php...o&userid=30925
View this thread: http://www.excelforum.com/showthread...hreadid=506008


--

Dave Peterson
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
Finding Next Blank Cell in Blank Row Nick Wakeham Excel Worksheet Functions 3 June 11th 08 02:15 PM
Finding next non-blank cell Stu[_2_] Excel Discussion (Misc queries) 4 October 23rd 07 01:29 PM
Finding next blank cell JaiD Excel Programming 2 June 13th 04 10:23 AM
Finding the Blank Cell Cory Thomas[_2_] Excel Programming 0 June 2nd 04 05:54 PM
Finding first non-blank cell Allison[_2_] Excel Programming 7 October 18th 03 01:47 AM


All times are GMT +1. The time now is 12:20 PM.

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"