Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Using variable as row reference in VBA

Hi,
In my macro, I'm trying to reference an integer as a row reference.
The idea is that as the macro goes through the worksheet, the integer
will increment where required. Currently the cell is in column A. Any
help would be greatly appreciated.


Dim CellCount As Integer
Dim OrderCount As Integer

CellCount = 6
OrderCount = 1

Range("A&CellCount&").Select
ActiveCell.FormulaR1C1 = OrderCount

OrderCount++


Thank you kindly
Khurram

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Using variable as row reference in VBA

Thank you Randy, This has given me a good point of reference.

regards
Khurram

RST wrote:

Khurram,

I use "cells" when I want to increment through rows or columns in a
worksheet. Try something like this:

Dim CellCount as Integer
Dim OrderCount as Integer

CellCount = 6
OrderCount = 1

Do Until ........[Enter Do/Loop Criteria]

Cells(CellCount,1)=OrderCount

CellCount=CellCount + 1
OrderCount=OrderCount + 1

Loop Until .......[Enter Do/Loop Criteria]

Hope this helps...
Randy




"Deecrypt" wrote:

Hi,
In my macro, I'm trying to reference an integer as a row reference.
The idea is that as the macro goes through the worksheet, the integer
will increment where required. Currently the cell is in column A. Any
help would be greatly appreciated.


Dim CellCount As Integer
Dim OrderCount As Integer

CellCount = 6
OrderCount = 1

Range("A&CellCount&").Select
ActiveCell.FormulaR1C1 = OrderCount

OrderCount++


Thank you kindly
Khurram



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
Variable reference DoctorG Excel Programming 1 July 20th 06 01:49 PM
How to use variable in reference Ming Excel Worksheet Functions 2 July 27th 05 11:24 PM
Problem with =sum(offset(cell reference,w,x,y,z). I want cell reference to be variable [email protected] Excel Worksheet Functions 2 December 11th 04 12:00 AM
Variable reference John[_44_] Excel Programming 1 August 8th 03 04:53 PM
Using a variable as a row reference? mjmorrison Excel Programming 2 July 14th 03 07:51 PM


All times are GMT +1. The time now is 11:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"