Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2008

Tip: Looking for answers? Try searching our database.

Cell referencing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Doc60 - 08 Feb 2008 18:37 GMT
I am trying to have code in a macro look at a particular row/column in a
table and determine if it is has nothing it to move to another part of the
code to continue the macro. Not sure how to do this. If you can help, please
be specific with instructions (code).

Thanks
Helmut Weber - 08 Feb 2008 21:31 GMT
Hi Doc60,

just to get you started:

Sub Test40089()
With ActiveDocument.Tables(1)
  If Len(.Cell(2, 2).Range) = 2 Then
     MsgBox "Empty"
     ' what now
  End If
End With
End Sub

If a cell's range has a length of 2,
then it consists of nothing but the end-of-cell mark,
which is chr(13) & chr(7).

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
Doc60 - 11 Feb 2008 01:03 GMT
I don't  think this is what I am looking for. I want to do something like this,

If Cell 5,7 is "   " then goto... meaning another part of the code to
continue.

So what I am trying to do is have the macro look at a cell determine if
there is a number in it, if not move to another part of the code to continue
the macro.

Thank you

> Hi Doc60,
>
[quoted text clipped - 20 lines]
>
> Vista Small Business, Office XP
Helmut Weber - 11 Feb 2008 15:34 GMT
Hi Doc60,

maybe something along these lines:

Sub Macro2()
Dim oTbl As Table
Dim sTmp As String
Set oTbl = ActiveDocument.Tables(1)
With oTbl
  sTmp = .Cell(2, 2).Range.Text
  sTmp = Left(sTmp, Len(sTmp) - 2)
  If IsNumeric(sTmp) Then
     MsgBox "number"
     ' your code
  Else
     ' do nothing or whatever
  End If
End With
End Sub

Though numbers aren't just digits,
e.g "2E3" is numeric!

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.