Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need syntax help!


Hello,

I am simply trying to figure out how many rows of information exists i
my spreadsheet, but I've googled and googled and I can't find th
correct syntax for the code.

Basically. I am starting at like cell A5 and then I just want to coun
how many rows of below it (like cell A6, A7) have information in them.
And the code should stop immediately when a cell is empty.

Anyone know the syntax for the code like this

--
FC
-----------------------------------------------------------------------
FCC's Profile: http://www.excelforum.com/member.php...fo&userid=3588
View this thread: http://www.excelforum.com/showthread.php?threadid=55721

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Need syntax help!

Hi FCC,

Try:

'=============
Public Sub Tester()
Dim LastRow As Long
Const FirstRow As Long = 5
Dim iRows As Long

LastRow = Cells(Rows.Count, "A").End(xlUp).Row

iRows = LastRow - FirstRow + 1

MsgBox "Number of rows = " & iRows

End Sub
'<<=============


---
Regards,
Norman


"FCC" wrote in message
...

Hello,

I am simply trying to figure out how many rows of information exists in
my spreadsheet, but I've googled and googled and I can't find the
correct syntax for the code.

Basically. I am starting at like cell A5 and then I just want to count
how many rows of below it (like cell A6, A7) have information in them.
And the code should stop immediately when a cell is empty.

Anyone know the syntax for the code like this?


--
FCC
------------------------------------------------------------------------
FCC's Profile:
http://www.excelforum.com/member.php...o&userid=35888
View this thread: http://www.excelforum.com/showthread...hreadid=557210



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need syntax help!


Private sub macro1()
Dim Z as integer
Z = 1

Do until sheet1.range("A" & Z).value = ""
If sheet1.range("A" & Z).value = "" then
' ""
else

Z = Z +1
end if
loop
sheet1.range("B1").value = Z
end sub

"you can pick up the Z value at cell B1"


--
T.c.Goosen1977
------------------------------------------------------------------------
T.c.Goosen1977's Profile: http://www.excelforum.com/member.php...o&userid=35895
View this thread: http://www.excelforum.com/showthread...hreadid=557210

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need syntax help!


Awesome.

Is there like a false conditional statement in VBA?

Like do this if this is false, (eg. != exists in Java)

BTW, I am a Java programmer and having heaps of trouble trying to do
VBA.


--
FCC
------------------------------------------------------------------------
FCC's Profile: http://www.excelforum.com/member.php...o&userid=35888
View this thread: http://www.excelforum.com/showthread...hreadid=557210

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need syntax help!


can u give more info on what u want to d

--
T.c.Goosen197
-----------------------------------------------------------------------
T.c.Goosen1977's Profile: http://www.excelforum.com/member.php...fo&userid=3589
View this thread: http://www.excelforum.com/showthread.php?threadid=55721



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need syntax help!


I was actually working on a similar sub:


Code:
--------------------

Range("A5").Select
Do
ActiveCell.Offset(1, 0).Select
Loop While ActiveCell.Value != ""

--------------------


Yeah, it's basically the same thing you guys have, but I found out the
!= code doesn't exist. I just want to select the first cell that
doesn't contain information.


--
FCC
------------------------------------------------------------------------
FCC's Profile: http://www.excelforum.com/member.php...o&userid=35888
View this thread: http://www.excelforum.com/showthread...hreadid=557210

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need syntax help!


Sub macro2()
Dim Z As Integer

Z = 1

Do Until Sheet1.Range("e" & Z).Value 0
If Range("e" & Z).Value = "" Then
Z = Z + 1
Else
' ""
End If
Range("a1").Value = Z
Loop


Z = Range("A1").Value
Do Until Sheet1.Range("e" & Z).Value < 0
If Range("e" & Z).Value = "" Then
' ""
Else
Z = Z + 1
' ""
End If
Range("a2").Value = Z
Loop

End Sub


"now use the values in cel A1 & A2 to Offset the range"


--
T.c.Goosen1977
------------------------------------------------------------------------
T.c.Goosen1977's Profile: http://www.excelforum.com/member.php...o&userid=35895
View this thread: http://www.excelforum.com/showthread...hreadid=557210

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
IRR Syntax Bruce Excel Worksheet Functions 1 July 13th 07 09:02 PM
Help with Syntax Steve Excel Discussion (Misc queries) 2 June 21st 07 06:52 PM
SQL syntax Spike Excel Worksheet Functions 2 March 8th 07 08:27 AM
syntax help Blue Excel Programming 3 September 29th 04 11:51 PM
syntax for a sub ( ) ibrahim Excel Programming 0 July 22nd 03 03:11 PM


All times are GMT +1. The time now is 10:31 AM.

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"