Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Append Worksheet name to each begining of each row with values
Excel 2007
Hello, I need to create a macro that will go through each worksheet and append the worksheet name to the begining of each row if there is a value. Here is what I have so far. This runs but takes my last worksheet name and appends that name to the rows in my first worksheet instead of appending my first worksheet name. Sub Append() Dim LastRow As Long Dim cl As Range Dim ws As Worksheet For I = 1 To Worksheets.Count With Worksheets(1) Set ws = Worksheets(I) .Cells(I, 1).Value = ws.Name End With Next I LastRow = Range(Cells(Rows.Count), Cells(Rows.Count, 1)).End(xlUp).Row For Each cl In Range(Cells(1, 1), Cells(LastRow, 1)) If Not IsEmpty(cl) Then cl.Value = ws.Name & "." & cl.Value End If Next cl End Sub -- Thanks for the help, Glenn |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Append values and remove text | Excel Worksheet Functions | |||
append worksheet with data from another | Excel Worksheet Functions | |||
how can I Append values to an existing excel file. | New Users to Excel | |||
Append Text to Cell Values Using Replace | Excel Discussion (Misc queries) | |||
re-naming worksheet tab adds ".xls]" to the begining of the name I entered | Excel Worksheet Functions |