LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default VBA - Modify data in selection

I need to concatenate a string in a column of a sheet based on user selection.

Column L contains a string to which I need to add either "(SC)" or "(DR#)"
where # is a number between 1 and 7. Ideally, the users can select the rows
they wish to modify (be it 1 row or 1000), right-click the mouse and choose
the appropriate modifier.

In my code, Selekt is a public variable to hold the choice from the
right-click. Note that there are two attempts to make this work with
different coding. The first is from another forum and I think it is closer to
doing what I need. The second is what I tried at the beginning.

Here's the code I have so far:

Private Sub InsertDR()

Dim t As Long
Dim rainj as range
Dim ro as range
Dim rev As String

If Selekt = "0" Then
For i = 1 To Selection.Rows.Count
rev = CStr(Sheet1.Cells(ro, 12).Value)
rev = rev & "(SC)"
Sheet1.Cells(ro, 12).Value = rev
Next
ElseIf CInt(Selekt) < 8 Then
rainj = ActiveSheet.Selection
For Each ro In rainj
rev = CStr(Sheet1.Cells(ro, 12).Value)
rev = rev & "(DR" & Selekt & ")"
Sheet1.Cells(ro, 12).Value = rev
Next
End If
End Sub

Any help here would be hot. Thanks!
--
Adios,
Clay Harryman
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Modify a calculated field formula depending upon selection of pagefield Tewari Excel Discussion (Misc queries) 0 April 10th 07 01:35 PM
"Modify Selection" button is grayed out Stove79 Excel Discussion (Misc queries) 1 December 8th 05 09:56 PM
Modify a data query ?? CM Excel Programming 2 November 10th 05 05:20 PM
modify the data in a report nabil Excel Programming 1 March 31st 05 03:29 AM
Help for modify data in excel! AAA[_2_] Excel Programming 3 January 31st 05 07:04 PM


All times are GMT +1. The time now is 11:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"