LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Detect tabular list in VBA

Assume you want their data starting in A1

Sub checkData()
Dim RealLastRow As Long
Dim RealLastColumn As Long
On Error Resume Next
RealLastRow = _
Cells.Find("*", Range("A1"), , , xlByRows, xlPrevious).Row
RealLastColumn = _
Cells.Find("*", Range("A1"), , , xlByColumns, xlPrevious).Column
set rng1 = Cells(RealLastRow, RealLastColumn)
set rng = Activesheet.Range("A1").currentRegion
if intersect(rng,rng1) is nothing or rng.rows.count = 1 or rng.columns.count
= 1 then
msgbox " could be problems"
exit sub
end if

End Sub

this certainly isn't the end all be all solution. If we knew what was
required, it would be easier to develop something to check.

--
Regards,
Tom Ogilvy

"quartz" wrote:

Good question.

The data the user has in their sheet should, for the most part be in a
rectangular shape and most if not all cells in the rectangle should be
populated. There should not be any stray data in the sheet.

"Nigel" wrote:

Are you saying that unless a range is selected an error is required or if
the activesheet is empty of any data?

--
Cheers
Nigel



"quartz" wrote in message
...
I am using Office 2003 on Windows XP.

I have a custom program for certain users, but as an error check, the
program needs to determine if the activesheet contains a tabular list of
data. For ease of use and flexibility, I don't want the user to have to
define a list, table, or range.

Most users will know that they need a starting tabular list (which could
span from 1 to 100 columns and any number of rows), so most of the time it
would run correctly. But if someone new, or someone just forgot, it would
be
nice if there were some sort of auto-detecting code that could determine
this
and generate a custom error message.

Any ideas on how to do this programmatically in VBA?

Thanks much in advance.




 
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
Create a tabular control rkg Excel Discussion (Misc queries) 0 August 8th 05 09:25 PM
Tabular to CSV style layout Michael Beckinsale Excel Programming 3 June 28th 05 01:55 PM
Converting to tabular format? Steve Excel Programming 0 July 29th 04 04:08 AM
Excel Vba -userform Tabular Column sarasa[_2_] Excel Programming 1 June 11th 04 03:18 PM
tabular questionable Elsa Perez Excel Programming 1 February 24th 04 04:45 PM


All times are GMT +1. The time now is 06:21 PM.

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"