Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello everybody!!
I spent a lot of time on a curious bug, and I wanted your advise. I created a function that must simlpy copy some cells in another range. This function take a range object as parameter to determine source of datas to copy: Public Function PuF_FormatCpyField(V_Range As Range) ' If there is more than 1 project imported, we copy/paste ' the formula to all rows containing data If GV_NumProjects 1 Then With V_Range.Worksheet V_Range.Rows(2).Copy _ (.Range(.Cells(3, V_Range.Column), .Cells(GV_NumProjects + 1, V_Range.Column + V_Range.Columns.Count - 1))) End If End With End Function .... but this doesn't work, and a beautiful "Copy Method of Range class failed" occurs... I've been able to solve this problem by changing With V_Range.Worksheet by With Worksheets("NameOfMyWorksheet") I really don't understand why this problem happens... Does somebody have an idea? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I found a better solution:
With Worksheets(V_Range.Worksheet.Name) This one works perfectly great... This problem sounds like an Excel bug, don't you think? I thought that perhaps my ranges were erroneous, but doing V_Range.Rows(2).Activate or (.Range(.Cells(3, V_Range.Column), .Cells(GV_NumProjects + 1, V_Range.Column + V_Range.Columns.Count - 1)).Activate works perfectly... Only he copy function doesn't work... Strange, isn't it? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
strange error | Excel Discussion (Misc queries) | |||
strange error | Excel Worksheet Functions | |||
Strange error | Setting up and Configuration of Excel | |||
Very strange error | Excel Discussion (Misc queries) | |||
Strange error | Excel Programming |