Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
HI,
I have written following piece of code Private Sub Workbook_Open() Dim spr, x, val As Integer x = 5 Worksheets("Sheet1").Range("C4:I205").Copy 'Worksheets("Sheet2").Range("C4").PasteSpecial Operation:=xlPasteValues, _ SkipBlanks:=True While (x <= 200) Debug.Print x val1 = Worksheets("Sheet2").Range("C" + Str(x + 1)).Value If IsEmpty(Worksheets("Sheet 2").Range("C" + Str(x))) Then val = val1 Worksheets("Sheet2").Range("C" + Str(x)) = val Worksheets("Sheet2").Range("C" + Str(x + 1)) = "" End If x = x + 1 Wend End Sub ============================== I am continuolsy getting Run time Error '1004' at line Worksheets("Sheet2").Range("C4").PasteSpecial Operation:=xlPasteValues, _ SkipBlanks:=True On changing this line to Worksheets("Sheet2").Paste (Range("C4")), I am still getting the same error. I commented these two lines and now I am getting the same error(Run tiem error '1004') at val1 = Worksheets("Sheet2").Range("C" + Str(x + 1)).Value I am just not able to understand why am I getting this error all the time ! Please help. TIA Shilps |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Filtered Mode Copying and pasting as value yield as error? | Excel Discussion (Misc queries) | |||
Copying data from 1 worksheet and pasting to another skipping blan | Excel Discussion (Misc queries) | |||
Copying and pasting tabular text data | Excel Discussion (Misc queries) | |||
Copying and pasting data muiltiple times | Excel Discussion (Misc queries) | |||
Copying and pasting data muiltiple times | Excel Discussion (Misc queries) |