From: tompl on 3 Apr 2010 16:01 I did not fully understand your question before, but this should work for you: Sub climate3() Dim xLng As Long, yLng As Long xLng = Range("X" & Rows.Count).End(xlUp).Row yLng = InputBox("enter the row number to paste") Range("A2:BK" & xLng).Cut Range("A" & yLng) Application.CutCopyMode = False Range("A1").Select MsgBox "Updated" End Sub
From: climate on 3 Apr 2010 23:58 Hi Thank you very much, your code work's correctly. regards "tompl" wrote: > I did not fully understand your question before, but this should work for you: > > Sub climate3() > > Dim xLng As Long, yLng As Long > xLng = Range("X" & Rows.Count).End(xlUp).Row > yLng = InputBox("enter the row number to paste") > Range("A2:BK" & xLng).Cut Range("A" & yLng) > Application.CutCopyMode = False > Range("A1").Select > MsgBox "Updated" > > End Sub >
From: climate on 4 Apr 2010 00:12 Hi Thank's Rick, your discussion is right. regards "Rick Rothstein" wrote: > It would have helped if along with telling us what the error message was if > you also told us what line it occurred on (which line did the debugger > highlight). I have no idea if the following is the root of your problem or > not, but this line is not doing what you think... > > Range("A2:BK2" & x).Copy > > That is not how you construct the range you want. The "2" at the end of > "BK2" should not be there. For example, if "x" evaluates to, say, 999, then > your range becomes A2:BK2999, not A2:BK999... that is some 2000 rows below > the last piece of data in Column X. I believe you want this instead... > > Range("A2:BK" & x).Copy > > -- > Rick (MVP - Excel) > > > > "climate" <climate(a)discussions.microsoft.com> wrote in message > news:93835349-DD78-4166-9DFE-45416AA0474D(a)microsoft.com... > > I have following code: > > Sub climate() > > Dim x As Long, y As Long > > x = Range("X" & Rows.Count).End(xlUp).Row > > y = InputBox("enter the row number to paste") > > Range("A2:BK2" & x).Copy > > Range("A" & y).PasteSpecial > > MsgBox "Updated" > > End Sub > > > > I want to cut data of range(A2:BK2 to end row related) and then paste to > > row > > number which determine in Box. when i run above code on some of sheets, > > error > > message appear(Run Time error 1004). please note that, this code with cut > > command not run, only with copy command. > > > > any help will be greatly appreciated. > > climate > > . >
First
|
Prev
|
Pages: 1 2 Prev: don't know what function to use Next: Follow up question about consolidating dups and sums |