Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello
I have many colums of data (characters) What I want to do is, highlight the required cells in the column and then either press a button or whatever to trigger the code to run. The code should append numbers to the existing data. for e.g: Column: AA BB TH XH HB SO I want the code to do this: 30AA 31BB 32TH 33XH 34HB 35SO Can the code ask me what is the starting number I want to append? Can somebody show me a sample how to do this? Thank you very much. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hello Hemang Shah, This macro will prompt you for a starting number and then appen it t the data in the cells you have selected. The cells need not b contiguous. Add a VBA module to your project and paste this macro into. You ca then assign the macro to an object or run it using the Macro Dialo (press ALT+F8 while in Excel). Code ------------------- Sub AppendNumber() Dim Answer Dim ChoosenCells As Range Dim I As Long Answer = InputBox("Enter your starting sequence number.") If Answer = "" Then Exit Sub I = Answer For Each ChoosenCell In Selection With ChoosenCell .Value = I & .Text End With I = I + 1 Next ChoosenCell End Sub ------------------- Sincerely, Leith Ros -- Leith Ros ----------------------------------------------------------------------- Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846 View this thread: http://www.excelforum.com/showthread.php?threadid=55481 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Append columns to existing worksheet? | Excel Programming | |||
How do I, in a marco VBA, code to take data from excel and append it to Access? | Excel Programming | |||
How do I paste to append instead of replace existing data? | Excel Discussion (Misc queries) | |||
How to append existing series? | Charts and Charting in Excel | |||
Help modify simple existing code?? | Excel Programming |