LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Populating cells

Hi,

I have this seemingly easy problem that has me stumped.

I want to populate cells, starting on Sheet3!A1. I want to use 1000 rows
and as many columns as necessary (it will be less than 10). I don't know in
advance how many cells will be required.

Below is a snippet of my code. Watch for the line wrap.

My row number appears to work, though it seems to me to be a bit clumsy.
Any better suggestions most appreciated. The column number does not work
correctly. For example, if the iCounter1=1000, it should be on A1000.
Instead, my code will give B1000 (as it should given what I have coded).
How do I fix this such that I use the first 1000 rows, and as many columns
as necessary?

Thank you.

Regards,
Kevin


For Each rnCell In rnRange1
Set rnMatchData = rnRange2.Find(rnCell.Value, LookIn:=xlValues)
If rnMatchData Is Nothing Then
If iCounter1 Mod 1000 = 0 Then
iRowNum = 1000
Else
iRowNum = iCounter1 Mod 1000
End If
iColNum = Int(iCounter1 / 1000) + 1
Worksheets("Sheet3").Cells(iRowNum, iColNum).Value =
rnCell.Value
iCounter1 = iCounter1 + 1
End If
Next rnCell


 
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
Populating Cells rciolkosz Excel Discussion (Misc queries) 3 August 27th 08 06:54 PM
Randomly populating empty cells with other text cells Throme88 Excel Discussion (Misc queries) 3 July 1st 08 02:58 PM
Help with auto populating cells. Brad Excel Worksheet Functions 4 September 29th 07 02:38 AM
Populating empty cells Colin Hayes Excel Worksheet Functions 4 August 4th 06 05:51 PM
Populating several cells A Excel Worksheet Functions 1 September 15th 05 05:58 PM


All times are GMT +1. The time now is 08:34 PM.

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"