Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Paste Special (Values) | Excel Programming | |||
Paste Special - Values | Excel Worksheet Functions | |||
Paste Special values only | Excel Worksheet Functions | |||
paste special values | Excel Worksheet Functions | |||
Dynamic Copy/Paste Special Formulas/Paste Special Values | Excel Programming |