LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 26
Default Paste values for entire row based on cell contents

Hi all

Hoping someone can help out. I want to paste the values in the entire row
based on the contents of one cell in that row.

Column Q is "Approved Status" with formula that is either Current or
Expired. When the formula changes to expired, the user activates a macro to
send an email with the expired cases. Expired then changes to Emailed. I
would like all the cells in that row to then be copied and pasted with their
values rather than the formula that exist in the other cells. This is the
macro I have so far - thanks to Ron DeBruin:

Sub Mail_Selection_Range_Outlook_Body()
' Don't forget to copy the function RangetoHTML in the module.
' Working in Office 2000-2007

ActiveSheet.Unprotect
Selection.AutoFilter Field:=16, Criteria1:="expired"
Rows("2:2").Select
Range("B2").Activate
Selection.EntireRow.Hidden = True


Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object

Set rng = Nothing
On Error Resume Next
'Only the visible cells in the selection
Set rng =
Sheets("Approvals").Range("b3:q20").SpecialCells(x lCellTypeVisible)

On Error GoTo 0


If rng Is Nothing Then
MsgBox "The selection is not a range or the sheet is protected" & _
vbNewLine & "please correct and try again.", vbOKOnly
Exit Sub
End If

With Application
.EnableEvents = False
.ScreenUpdating = False
End With

Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "CRCs Requiring New Approvals - Please Action"
.HTMLBody = RangetoHTML(rng)
.Display
End With
On Error GoTo 0

With Application
.EnableEvents = True
.ScreenUpdating = True
End With

Set OutMail = Nothing
Set OutApp = Nothing

Selection.AutoFilter Field:=16
Cells.Select
Range("B3").Activate
Selection.EntireRow.Hidden = False
Rows("1:1").Select
Range("B1").Activate
Selection.EntireRow.Hidden = True

ActiveSheet.Unprotect
Range("B3:U13").Select
Selection.sort Key1:=Range("Q4"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal



n = Cells(Rows.Count, "q").End(xlUp).Row
For i = 1 To n
With Cells(i, "q")
If .Value = "Expired" Then .Value = "Emailed"
End With
Next


ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowFiltering:=True
End Sub



 
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
Copy Paste Values - Entire Workbook and Save Scott Campbell[_2_] Excel Discussion (Misc queries) 1 August 9th 07 07:53 PM
Modify Row & Cell Contents based upon Cells Values bpat1434 Excel Worksheet Functions 0 November 7th 04 03:31 PM
Modify Row & Cell Contents based upon Cells Values bpat1434 Excel Worksheet Functions 1 November 7th 04 12:43 PM
Modify Row & Cell Contents based upon Cells Values bpat1434 Excel Worksheet Functions 1 November 7th 04 03:12 AM
Modify Row & Cell Contents based upon Cells Values bpat1434 Excel Worksheet Functions 1 November 6th 04 05:17 PM


All times are GMT +1. The time now is 12:51 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"