Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Populating a Named Range...

Hi Everybody,

Using Excel 97, I have a Range object that is Set to a Named Range on a
WorkSheet
e.g.

Dim Rng as Range

Set Rng = ThisWorkbook.Worksheets("MySheet").Range("Incident s")

"Incidents" is a named range that represents the first 10 rows of my
Worksheet and includes only Columns "A","B" and "D" of those 10 rows
(Columns C is excluded)
My problem is when I dynamically populate Rng with values the data ends up
in Columns "A", "B" and "C" (Column D should have contained data instead
Column C holds it)

Rng(j, i).Value = "SomeData"

Where j and i iteratively represent 10 Rows across 3 Columns (Columns "A",
"B" and "D")

Am I allowed to define a Range that skips a column?

Thanks for any help!
Sam


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Populating a Named Range...

You are, but Rng(j,i) referes to a cell j columns and i rows from the first
cell in Rng. This is not necessarily a cell within Rng.

Here is an example to populate Rng

Set rng = Range("A1:A10,C1:C10")
i = 1: j = 1
For Each cell In rng
cell = i * j
i = i + 1
If i 10 Then
i = 1
j = j + 1
End If
Next cell

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"debartsa" wrote in message
...
Hi Everybody,

Using Excel 97, I have a Range object that is Set to a Named Range on a
WorkSheet
e.g.

Dim Rng as Range

Set Rng = ThisWorkbook.Worksheets("MySheet").Range("Incident s")

"Incidents" is a named range that represents the first 10 rows of my
Worksheet and includes only Columns "A","B" and "D" of those 10 rows
(Columns C is excluded)
My problem is when I dynamically populate Rng with values the data ends up
in Columns "A", "B" and "C" (Column D should have contained data instead
Column C holds it)

Rng(j, i).Value = "SomeData"

Where j and i iteratively represent 10 Rows across 3 Columns (Columns "A",
"B" and "D")

Am I allowed to define a Range that skips a column?

Thanks for any help!
Sam




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Populating a Named Range...

Thanks Bob!


"Bob Phillips" wrote in message
...
You are, but Rng(j,i) referes to a cell j columns and i rows from the

first
cell in Rng. This is not necessarily a cell within Rng.

Here is an example to populate Rng

Set rng = Range("A1:A10,C1:C10")
i = 1: j = 1
For Each cell In rng
cell = i * j
i = i + 1
If i 10 Then
i = 1
j = j + 1
End If
Next cell

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"debartsa" wrote in message
...
Hi Everybody,

Using Excel 97, I have a Range object that is Set to a Named Range on a
WorkSheet
e.g.

Dim Rng as Range

Set Rng = ThisWorkbook.Worksheets("MySheet").Range("Incident s")

"Incidents" is a named range that represents the first 10 rows of my
Worksheet and includes only Columns "A","B" and "D" of those 10 rows
(Columns C is excluded)
My problem is when I dynamically populate Rng with values the data ends

up
in Columns "A", "B" and "C" (Column D should have contained data instead
Column C holds it)

Rng(j, i).Value = "SomeData"

Where j and i iteratively represent 10 Rows across 3 Columns (Columns

"A",
"B" and "D")

Am I allowed to define a Range that skips a column?

Thanks for any help!
Sam






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
Populating a range from tab b into tab a Xman Excel Worksheet Functions 1 February 24th 10 01:42 PM
Populating a cell based on a range of values akkrug New Users to Excel 2 June 20th 08 03:09 PM
Populating a Range Dependant on a List [email protected] Excel Worksheet Functions 9 November 5th 07 09:24 AM
Array as a "named range" - formula ok in cells, but error as "named range" tskogstrom Excel Discussion (Misc queries) 11 December 28th 06 04:44 PM
inserting a named range into new cells based on a named cell Peter S. Excel Discussion (Misc queries) 1 June 4th 06 03:53 AM


All times are GMT +1. The time now is 10:46 AM.

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"