Solved

Excel Dynamic Cell Selections

Posted on 2000-03-30
1
168 Views
Last Modified: 2010-05-02

How do dynamically select Excel Columns in Visual Basic ? For example if I wanted to place database field names across in individual columns across the first row of a sheet how would I start with cell A1 and reference the next cell B1, C1.. ect.. without using code that looks like (if index = 1 then cell = "A1"... if index = 2 then cell = "A2" ??      
0
Comment
Question by:jeffreyclark
1 Comment
 
LVL 9

Accepted Solution

by:
samopal earned 50 total points
ID: 2670292
You can use this syntax

For i=1 to 10
 For j=1 to 10
   oEx.Cells(i,j).value = i*10+j
 Next
Next

where oEx is Excel object

HTH
0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question