Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Offset issue

I inherited a list of field heading that get built by hard coding as follows:
Range("A1").FormulaR1C1 = "Filed 1€¯
Range("B1").FormulaR1C1 = "Filed 2€¯

How can I increment for the start point of cell A1 omitting hard coded ranges?
Im currently messing around with offset€¦
Appreciatively,
Arturo

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Offset issue

Maybe...

'Select some cells
Sub MakeTitles()
Dim rCell As Range
For Each rCell In Application.Intersect(Selection.EntireColumn, Rows(1)).Cells
rCell.Value = "Filed " & rCell.Column
Next
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Arturo"
wrote in message
I inherited a list of field heading that get built by hard coding as follows:
Range("A1").FormulaR1C1 = "Filed 1€¯
Range("B1").FormulaR1C1 = "Filed 2€¯

How can I increment for the start point of cell A1 omitting hard coded ranges?
Im currently messing around with offset€¦
Appreciatively,
Arturo

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Offset issue

I stated the issue incorrectly.
What I've got working now is:
ActiveCell.Offset(0, 1).Select
ActiveCell = "ABC"
ActiveCell.Offset(0, 1).Select
ActiveCell = "123"
and so on...
All the differing field headings reside in code. Is there a cleaner way to
increment in the same line: ActiveCell.Offset(0, 1) and have it equal "XYZ",
then the line of code would be ActiveCell.Offset(0, 1) and have it equal
"LOB" and so on working from a long hard coded list. I hope this makes more
sence...



"Jim Cone" wrote:

Maybe...

'Select some cells
Sub MakeTitles()
Dim rCell As Range
For Each rCell In Application.Intersect(Selection.EntireColumn, Rows(1)).Cells
rCell.Value = "Filed " & rCell.Column
Next
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Arturo"
wrote in message
I inherited a list of field heading that get built by hard coding as follows:
Range("A1").FormulaR1C1 = "Filed 1€¯
Range("B1").FormulaR1C1 = "Filed 2€¯

How can I increment for the start point of cell A1 omitting hard coded ranges?
Im currently messing around with offset€¦
Appreciatively,
Arturo


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Offset issue


'Select some cells
Sub MakeTitles_R1()
Dim Ndx As Long
Dim rHeadings As Range
Dim vArray As Variant

vArray = Array("Aqua", "Black", " Blue ", "Blue-Gray", " Bright Green ", _
"Brown", " Coral", " Dark Blue", " Dark Green")
Set rHeadings = Application.Intersect(Selection.EntireColumn, Rows(1)).Cells

For Ndx = 1 To Application.Min(rHeadings.Count, UBound(vArray) + 1)
rHeadings(Ndx).Value = vArray(Ndx - 1)
Next
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Arturo"
wrote in message
I stated the issue incorrectly.
What I've got working now is:
ActiveCell.Offset(0, 1).Select
ActiveCell = "ABC"
ActiveCell.Offset(0, 1).Select
ActiveCell = "123"
and so on...
All the differing field headings reside in code. Is there a cleaner way to
increment in the same line: ActiveCell.Offset(0, 1) and have it equal "XYZ",
then the line of code would be ActiveCell.Offset(0, 1) and have it equal
"LOB" and so on working from a long hard coded list. I hope this makes more
sence...



"Jim Cone" wrote:
Maybe...
'Select some cells
Sub MakeTitles()
Dim rCell As Range
For Each rCell In Application.Intersect(Selection.EntireColumn, Rows(1)).Cells
rCell.Value = "Filed " & rCell.Column
Next
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Arturo"
wrote in message
I inherited a list of field heading that get built by hard coding as follows:
Range("A1").FormulaR1C1 = "Filed 1€¯
Range("B1").FormulaR1C1 = "Filed 2€¯

How can I increment for the start point of cell A1 omitting hard coded ranges?
Im currently messing around with offset€¦
Appreciatively,
Arturo


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
Cell offset issue MGarrison Excel Worksheet Functions 3 July 31st 08 03:52 PM
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul RyGuy Excel Worksheet Functions 2 September 28th 07 10:54 PM
Find, Copy offset to offset on other sheet, Run-time 1004. Finny[_3_] Excel Programming 10 December 7th 06 11:46 PM
Offset issue Hinojosa via OfficeKB.com Excel Programming 2 October 17th 06 02:26 PM
Offset issue? BigWave@AC Excel Programming 4 August 3rd 06 05:51 PM


All times are GMT +1. The time now is 12:27 PM.

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"