ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VBA search for value of a cell (https://www.excelbanter.com/excel-programming/383885-excel-vba-search-value-cell.html)

Larry D[_2_]

Excel VBA search for value of a cell
 

I am working on some vba code in Excel 2000 with Microsoft Windows
2000.

I want to select the first cell in a tab and see if it has a value in
it.

I would like the code to look something like this:

sheets("firsttab").select
range("a1").select
set currentcell=activecell

if current cell < "" then
msgbox "There is data in the first tab", vbok
end if

Any idea what I am doing wrong?


JMay

Excel VBA search for value of a cell
 
Assuming you have a Sub header and Footer

The only problem I see is the SPACE you currently have
between "current cell" in your If line.

HTH

"Larry D" wrote in message
oups.com:

I am working on some vba code in Excel 2000 with Microsoft Windows
2000.

I want to select the first cell in a tab and see if it has a value in
it.

I would like the code to look something like this:

sheets("firsttab").select
range("a1").select
set currentcell=activecell

if current cell < "" then
msgbox "There is data in the first tab", vbok
end if

Any idea what I am doing wrong?



Alan[_2_]

Excel VBA search for value of a cell
 
If Sheets("FirstTab").Range("A1") < "" Then
MsgBox "There is data in the first tab", vbOK
End If

Regards,

Alan


"Larry D" wrote in message
oups.com...

I am working on some vba code in Excel 2000 with Microsoft Windows
2000.

I want to select the first cell in a tab and see if it has a value in
it.

I would like the code to look something like this:

sheets("firsttab").select
range("a1").select
set currentcell=activecell

if current cell < "" then
msgbox "There is data in the first tab", vbok
end if

Any idea what I am doing wrong?





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

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