LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Paste Special, Values only

I think I've cleaned up your code a bit. I like to avoid using SELECT if at
all possible because I find it slows down execution. Try it in a test
workbook if you want.

Sub InsertData(ByVal SheetName As String, ByVal Column As String, _
ByVal Value As String)
Dim RowIndex As Integer

Dim myWS As Worksheet
Dim myRange As Range

Set myWS = Nothing
On Error Resume Next
Set myWS = Sheets(SheetName)
On Error GoTo 0
If myWS Is Nothing Then
MsgBox ("There is no sheet of name '" & SheetName & "' in the
workbook")
Exit Sub
End If

Set myRange = myWS.Range(Column & "2")
If myRange.Column < 1 Then
Set myRange = myRange.Offset(-1, 0)
End If

Do
Set myRange = myRange.Offset(1, 0)

Loop While Not IsEmpty(myRange)
myRange.Value = Value
End Sub

--
HTH,
Barb Reinhardt



"EmmieLou" wrote:

I have part of the code here, I want to include a paste special to get only
the value of cell H3, not the formula. The value comes from a lookup
function in the sheet "Summary" and I want to paste the value in to another
worksheet, "Pedigrees."

Call InsertData("Pedigrees", "N", GetData("Summary", "H3"))
Thanks!!

 
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
Paste Special (Values) Chris Excel Programming 5 August 6th 07 11:37 PM
Paste Special - Values KYMO Excel Worksheet Functions 1 June 8th 06 05:17 PM
Paste Special values only AJPendragon Excel Worksheet Functions 1 February 22nd 05 11:05 AM
paste special values jenn Excel Worksheet Functions 2 February 3rd 05 01:45 AM
Dynamic Copy/Paste Special Formulas/Paste Special Values Sharon Perez Excel Programming 3 August 7th 04 09:49 PM


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