![]() |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 05:47 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com