Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Test a named cell in a macro

I need to test a named cell in the excel sheet to see if there is any
data in the cell.

Currently I am doing:

'Req Number
If Trim(Cells(4, 7)) = "" Then
errtest = errtest & "Please Fill in the Req Number"
End If

The problem is that the cells 4,7 may change, as new lines get added
to the sheet. So I have named it ReqNo in the sheet. Then even if new
lines are added, the test will still be on the correct field.

But I don't know how to call it.

I have tried the following:
Cells("ReqNo")
Cells('ReqNo')
Activecell.ReqNo
select.cell.ReqNo
ect, ect , ect

Does anyone know how to call a named cell in the macro?

Cheers for all help,
Caroline

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 772
Default Test a named cell in a macro

Use range to select a named cell

ActiveSheet.Range("reqno") = "123"

--
-John
Please rate when your question is answered to help us and others know what
is helpful.


" wrote:

I need to test a named cell in the excel sheet to see if there is any
data in the cell.

Currently I am doing:

'Req Number
If Trim(Cells(4, 7)) = "" Then
errtest = errtest & "Please Fill in the Req Number"
End If

The problem is that the cells 4,7 may change, as new lines get added
to the sheet. So I have named it ReqNo in the sheet. Then even if new
lines are added, the test will still be on the correct field.

But I don't know how to call it.

I have tried the following:
Cells("ReqNo")
Cells('ReqNo')
Activecell.ReqNo
select.cell.ReqNo
ect, ect , ect

Does anyone know how to call a named cell in the macro?

Cheers for all help,
Caroline


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
Named Cell test Brettjg Excel Discussion (Misc queries) 4 June 11th 07 03:30 AM
exit macro after test of cell value Pepestru Excel Programming 4 February 23rd 07 02:36 PM
Test if ActiveCell is within a certain named range Steven Excel Programming 2 March 8th 06 05:18 PM
How to test cell contents in a macro? JennyGard Excel Programming 4 February 22nd 06 03:08 PM
Test if Active Cell is in a named range Simon Shaw[_5_] Excel Programming 1 September 28th 04 12:11 AM


All times are GMT +1. The time now is 06:53 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"