ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need syntax help! (https://www.excelbanter.com/excel-programming/365911-need-syntax-help.html)

FCC[_6_]

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


Norman Jones

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




T.c.Goosen1977[_8_]

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


FCC[_7_]

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


T.c.Goosen1977[_10_]

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


FCC[_8_]

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


T.c.Goosen1977[_11_]

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



All times are GMT +1. The time now is 05:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com