Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I'm trying to insert Item numbers in cells next to rows that have data in
the data column. BEFORE AFTER COL A Col A Col B DATA ITEM DATA 99 1 99 98 2 98 97 3 97 84 4 84 34 5 34 The macro selects the proper numerical row value for FirstRow and LastRow, inserts the Column name (Item) and inserts the series starting number ( 1 ), but I get a global error for the Range statement, and the series doesn¹t run. How to change? Sub AddItemNumber() Cells.Find(What:="Date", After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False).Activate LastRow = ActiveCell.End(xlDown).Row ActiveCell.EntireColumn.Insert ActiveCell.Value = "Item" ActiveCell.Offset(1).Value = 1 FirstRow = ActiveCell.Row + 1 Range("FirstRow" & "LastRow").Select ŒRange(³FirstRow:LastRow²).Select ActiveCell.DataSeries Rowcol:=xlColumns, _ Type:=xlLinear, Date:=xlDay, Step:=1, Trend:=False End Sub |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
hi
i don't see in your code where you set firstrow and lastrow but if you have just posted part of your code and have set firstrow and lastrow then this might work better...... Range(firstrow, lastrow).Select regards FSt1 "Gene Augustin" wrote: I'm trying to insert Item numbers in cells next to rows that have data in the data column. BEFORE AFTER COL A Col A Col B DATA ITEM DATA 99 1 99 98 2 98 97 3 97 84 4 84 34 5 34 The macro selects the proper numerical row value for FirstRow and LastRow, inserts the Column name (Item) and inserts the series starting number ( 1 ), but I get a global error for the Range statement, and the series doesn¹t run. How to change? Sub AddItemNumber() Cells.Find(What:="Date", After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False).Activate LastRow = ActiveCell.End(xlDown).Row ActiveCell.EntireColumn.Insert ActiveCell.Value = "Item" ActiveCell.Offset(1).Value = 1 FirstRow = ActiveCell.Row + 1 Range("FirstRow" & "LastRow").Select ŒRange(³FirstRow:LastRow²).Select ActiveCell.DataSeries Rowcol:=xlColumns, _ Type:=xlLinear, Date:=xlDay, Step:=1, Trend:=False End Sub |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
range(firstrow & ":" & lastrow).select
By the way, these newsgroups are plain text only--no attachments and no HTML/rich text. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to insert same row numbers in several function statement | Excel Discussion (Misc queries) | |||
how do I insert Item numbers | Excel Discussion (Misc queries) | |||
Insert spaces in String of Numbers | Excel Worksheet Functions | |||
how to insert page numbers | Excel Discussion (Misc queries) | |||
how do I insert an ' in front of many rows of numbers? | Excel Discussion (Misc queries) |