Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 24th, 2007, 11:39 PM
Registered User
 
Join Date: Apr 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default VBA Code to read the structure & data of an excel

Hi ,

I am currently working on an excel sheet . That excel sheet will contain merged cells rowwise and columnwise but not both.

I have to determine the structure as well the data of the excel file . Can any one tell me the code for doing it . I am doing my coding in visual basic text editor of excel file. so please send the appropriate code.

Currently i have developed the macro for reading 10 unmerged rows & columns.Here it is :-



Sub proRead()
'Taufiq Alam Khan

Dim Selectedvalue As Double
Dim Counter As Double
Dim Row As Double
Row = 0

Range("A1").Select

Do Until Row = 10
For Counter = 1 To 10
Selectedvalue = Selection.Value
'Selection.Value = 0
Selection.Offset(0, 1).Select
Next
Selection.Offset(1, -10).Select
Row = Row + 1
Loop

Range("A1").Select

End Sub

This will only read the first 10 columns and first 10 rows of the excel file having unmerged cells . if this code is used for merged cells then it will throw an exception . so kindly suggest some solution for it .............





Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel VBA copy & paste wensmail Excel VBA 1 September 17th, 2007 11:13 PM
Code works in Excel VBA but not Access VBA fossx Access VBA 2 May 21st, 2007 08:00 AM
Excel VBA & SQL LouNeate Excel VBA 2 April 5th, 2007 01:28 PM
Read Excel Lines VBA gbvdh VB How-To 0 February 26th, 2007 08:44 AM
Excel VBA to SQL & back to VBA edesousa Excel VBA 1 June 1st, 2004 02:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.