Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Select multiple rows and add a value in a column

I use the code below to highlight the selected row on a worksheet. I want to
then put some text in a column on that row. I need to be able to select
multiple rows and perform the same task. I then run the 2nd macro to take
certain values from that row to another work sheet.
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
'Highlight Selected Row if not empty
ActiveSheet.Unprotect
Application.ScreenUpdating = False
Dim StrRow As String
Cells.FormatConditions.Delete
With Target.EntireRow
StrRow = .Address
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=counta(" & StrRow
& ")0"
.FormatConditions(1).Interior.ColorIndex = 27 'Color Yellow
Application.ScreenUpdating = True
End With
ActiveSheet.Protect
End Sub
Sub Accessories()
'
' Accessories Macro
' Macro recorded 19/5/01 by Alan McCruddden

r$ = Trim(Str(ActiveCell.Row))
Counter = 4
Do While Not Range("ToyotaQuotemaster.xls!A" & Counter).Value = ""
Counter = Counter + 1
Loop

If Counter <= 19 Then
Range("QM.xls!A" & Counter).Value = Range("B" + r$) 'Description
Range("QM.xls!B" & Counter).Value = Range("C" + r$) 'Model
Range("QM.xls!C" & Counter).Value = Range("A" + r$) 'Model
Range("QM.xls!D" & Counter).Value = Range("U" + r$) 'RRP
Range("QM.xls!G" & Counter).Value = Range("Z" + r$) 'Margin

Else
MsgBox "Too Many Items", vbExclamation, "Quotemaster"
End If

End Sub

Many thanks for any assistance
AJM1949
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Select multiple rows and add a value in a column

So what is the question?

--
Regards,
Tom Ogilvy


"AJM1949" wrote in message
...
I use the code below to highlight the selected row on a worksheet. I want

to
then put some text in a column on that row. I need to be able to select
multiple rows and perform the same task. I then run the 2nd macro to take
certain values from that row to another work sheet.
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
'Highlight Selected Row if not empty
ActiveSheet.Unprotect
Application.ScreenUpdating = False
Dim StrRow As String
Cells.FormatConditions.Delete
With Target.EntireRow
StrRow = .Address
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=counta(" &

StrRow
& ")0"
.FormatConditions(1).Interior.ColorIndex = 27 'Color Yellow
Application.ScreenUpdating = True
End With
ActiveSheet.Protect
End Sub
Sub Accessories()
'
' Accessories Macro
' Macro recorded 19/5/01 by Alan McCruddden

r$ = Trim(Str(ActiveCell.Row))
Counter = 4
Do While Not Range("ToyotaQuotemaster.xls!A" & Counter).Value = ""
Counter = Counter + 1
Loop

If Counter <= 19 Then
Range("QM.xls!A" & Counter).Value = Range("B" + r$) 'Description
Range("QM.xls!B" & Counter).Value = Range("C" + r$) 'Model
Range("QM.xls!C" & Counter).Value = Range("A" + r$) 'Model
Range("QM.xls!D" & Counter).Value = Range("U" + r$) 'RRP
Range("QM.xls!G" & Counter).Value = Range("Z" + r$) 'Margin

Else
MsgBox "Too Many Items", vbExclamation, "Quotemaster"
End If

End Sub

Many thanks for any assistance
AJM1949



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Select multiple rows and add a value in a column

Sorry I'm new to discussion groups. My question is 2 fold.
1. How do I put a value(Text)in a column on the selected row(same column for
multiple selections)?
2. How do I then get the second macro to run only on the rows selected?

Thanks
--
AJM1949


"Tom Ogilvy" wrote:

So what is the question?

--
Regards,
Tom Ogilvy


"AJM1949" wrote in message
...
I use the code below to highlight the selected row on a worksheet. I want

to
then put some text in a column on that row. I need to be able to select
multiple rows and perform the same task. I then run the 2nd macro to take
certain values from that row to another work sheet.
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
'Highlight Selected Row if not empty
ActiveSheet.Unprotect
Application.ScreenUpdating = False
Dim StrRow As String
Cells.FormatConditions.Delete
With Target.EntireRow
StrRow = .Address
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, Formula1:="=counta(" &

StrRow
& ")0"
.FormatConditions(1).Interior.ColorIndex = 27 'Color Yellow
Application.ScreenUpdating = True
End With
ActiveSheet.Protect
End Sub
Sub Accessories()
'
' Accessories Macro
' Macro recorded 19/5/01 by Alan McCruddden

r$ = Trim(Str(ActiveCell.Row))
Counter = 4
Do While Not Range("ToyotaQuotemaster.xls!A" & Counter).Value = ""
Counter = Counter + 1
Loop

If Counter <= 19 Then
Range("QM.xls!A" & Counter).Value = Range("B" + r$) 'Description
Range("QM.xls!B" & Counter).Value = Range("C" + r$) 'Model
Range("QM.xls!C" & Counter).Value = Range("A" + r$) 'Model
Range("QM.xls!D" & Counter).Value = Range("U" + r$) 'RRP
Range("QM.xls!G" & Counter).Value = Range("Z" + r$) 'Margin

Else
MsgBox "Too Many Items", vbExclamation, "Quotemaster"
End If

End Sub

Many thanks for any assistance
AJM1949




Reply
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
Select multiple rows not next to each other LarryJNX Excel Worksheet Functions 3 April 4th 23 02:20 PM
select multiple rows and format sdg8481 Excel Discussion (Misc queries) 7 October 5th 08 03:46 PM
Select all data, multiple rows George Wilson Excel Discussion (Misc queries) 6 December 5th 04 08:16 PM
how to select multiple rows using vba almostthere Excel Programming 6 June 4th 04 07:48 PM
Is there a smart way to select multiple rows based on column... Mike[_81_] Excel Programming 6 May 1st 04 12:51 PM


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

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

About Us

"It's about Microsoft Excel"