Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to add data
I have a column in a table to which I would like to add
the same data to every record in the column. Following is an example: Each record in my column B of the spreadsheet contains a unique value. I would like to preface that unique value, in every record in column B with the same path name. So if B2 currently contains "1233" in the field. I would like the macro to add "c:\data\" in front of it so the final result of the field is "c:\data\1233 TIA |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to add data
Hi Janna,
Assuming that your table has a header row, try: Sub Tester() Dim rng As Range, cell As Range Dim Lstcell As Range Set Lstcell = Cells(Rows.Count, "B").End(xlUp) Set rng = Range(Lstcell, Lstcell.End(xlUp)(2)) For Each cell In rng cell.Value = "c:\data\" & cell.Value Next End Sub --- Regards, Norman "Janna" wrote in message ... I have a column in a table to which I would like to add the same data to every record in the column. Following is an example: Each record in my column B of the spreadsheet contains a unique value. I would like to preface that unique value, in every record in column B with the same path name. So if B2 currently contains "1233" in the field. I would like the macro to add "c:\data\" in front of it so the final result of the field is "c:\data\1233 TIA |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to add data
Thanks Norman
It worked like a charm :-) Janna -----Original Message----- Hi Janna, Assuming that your table has a header row, try: Sub Tester() Dim rng As Range, cell As Range Dim Lstcell As Range Set Lstcell = Cells(Rows.Count, "B").End(xlUp) Set rng = Range(Lstcell, Lstcell.End(xlUp)(2)) For Each cell In rng cell.Value = "c:\data\" & cell.Value Next End Sub --- Regards, Norman "Janna" wrote in message ... I have a column in a table to which I would like to add the same data to every record in the column. Following is an example: Each record in my column B of the spreadsheet contains a unique value. I would like to preface that unique value, in every record in column B with the same path name. So if B2 currently contains "1233" in the field. I would like the macro to add "c:\data\" in front of it so the final result of the field is "c:\data\1233 TIA . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to copy data when data is detected in another column(s). | Excel Worksheet Functions | |||
Write Macro to Fix Data Alignment (Data dump from Crystal to Excel | Excel Discussion (Misc queries) | |||
Macro to move data to different column based on data in another co | Excel Discussion (Misc queries) | |||
enter data in cell which will start macro to move data to sheet2 | Excel Discussion (Misc queries) | |||
Macro that will autofill a column with data, up to the last row of data in previous c | Excel Programming |