PC Review


Reply
Thread Tools Rate Thread

Add a prefix

 
 
CAM
Guest
Posts: n/a
 
      21st Aug 2007
Hi,


In column A I have a worksheet that can have rows from 2 to 200 or more
depending upon the workbook. Row 1 is headers. The data will be "SS_11" in
row 2 "SS_12" in row 3 etc. What I want to do is to have a command button
to slightly change the data to add a prefix depending upon what I have in
cell F2. for example cell F2 has "Dept" so in column A should be
"Dept_SS_11" in row 2 v"Dept_SS12" in row 3 etc. In another workbook I
may have "Corp" in cell F2 then I should see in column A "Corp_SS_11" in
row 2 "Corp_SS_12" in row 3 etc. How do I add the prefex based on the
contend on F2, again depending upon the workbook I may have 2 row or more.
Any tips or website to visit will be appreciated. Thank you in advance.

Cheers.

 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      21st Aug 2007
Just run a simple macro

Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long
Dim iLastRow As Long

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 1 To iLastRow
.Cells(i, TEST_COLUMN).Value = .Range("F2").Value & _
.Cells(i, TEST_COLUMN).Value
Next i
End With

End Sub



--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"CAM" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
>
> In column A I have a worksheet that can have rows from 2 to 200 or more
> depending upon the workbook. Row 1 is headers. The data will be "SS_11"
> in row 2 "SS_12" in row 3 etc. What I want to do is to have a command
> button to slightly change the data to add a prefix depending upon what I
> have in cell F2. for example cell F2 has "Dept" so in column A should be
> "Dept_SS_11" in row 2 v"Dept_SS12" in row 3 etc. In another workbook I
> may have "Corp" in cell F2 then I should see in column A "Corp_SS_11" in
> row 2 "Corp_SS_12" in row 3 etc. How do I add the prefex based on the
> contend on F2, again depending upon the workbook I may have 2 row or more.
> Any tips or website to visit will be appreciated. Thank you in advance.
>
> Cheers.



 
Reply With Quote
 
CAM
Guest
Posts: n/a
 
      21st Aug 2007
Thanks Bob. I will give a try.

Cheers

"Bob Phillips" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Just run a simple macro
>
> Public Sub ProcessData()
> Const TEST_COLUMN As String = "A" '<=== change to suit
> Dim i As Long
> Dim iLastRow As Long
>
> With ActiveSheet
>
> iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
> For i = 1 To iLastRow
> .Cells(i, TEST_COLUMN).Value = .Range("F2").Value & _
> .Cells(i, TEST_COLUMN).Value
> Next i
> End With
>
> End Sub
>
>
>
> --
> HTH
>
> Bob
>
> (there's no email, no snail mail, but somewhere should be gmail in my
> addy)
>
> "CAM" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi,
>>
>>
>> In column A I have a worksheet that can have rows from 2 to 200 or more
>> depending upon the workbook. Row 1 is headers. The data will be "SS_11"
>> in row 2 "SS_12" in row 3 etc. What I want to do is to have a command
>> button to slightly change the data to add a prefix depending upon what I
>> have in cell F2. for example cell F2 has "Dept" so in column A should
>> be "Dept_SS_11" in row 2 v"Dept_SS12" in row 3 etc. In another
>> workbook I may have "Corp" in cell F2 then I should see in column A
>> "Corp_SS_11" in row 2 "Corp_SS_12" in row 3 etc. How do I add the
>> prefex based on the contend on F2, again depending upon the workbook I
>> may have 2 row or more. Any tips or website to visit will be appreciated.
>> Thank you in advance.
>>
>> Cheers.

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SUM without prefix Boris Microsoft Excel Misc 3 2nd Jan 2008 11:40 AM
VBA - xl Prefix ajocius Microsoft Excel Programming 1 26th Nov 2005 08:27 PM
how to cut local area code prefix in outlook or oe when dialing a loca phone number with local area code prefix? wisedom Microsoft Outlook Contacts 5 10th Mar 2005 10:01 AM
Tag prefix Blaz Ziherl Microsoft ASP .NET 3 22nd Nov 2004 09:58 PM
what prefix for...... Supra Microsoft Dot NET 2 17th Aug 2004 05:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:00 AM.