Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy Problem


Dear Friends,

I have the following codes to copy specific data from one sheet to
another

Private Sub CommandButton1_Click()
Dim x As Long
Dim y As Long
y = 1
For x = 1 To 65536
If Cells(x, 1).Value =1245 And Cells(x, 1).Value <= 2000 Then
Cells(x, 1).EntireRow.Copy
Sheets("sheet2").Cells(y, 1).PasteSpecial
y = y + 1
End If
Next x
Application.CutCopyMode = False
End Sub

1. Col A of active sheet has numeric values which are copied from
1245 to 2000 in Sheet2. If Col A contains Date values then above codes
does not work. How can I overcome the problem ?

2. If I create a temp worksheet through userform and then copy from
one sheet to tempws then these codes does not work.

The code for creating temp worksheet are as

Private sub userform_activate()

Dim tempws as worksheet
Set tempws = Thisworkbook.worksheets.add
Tempws.name = “Temp”

End sub

How I can overcome the above two problems

Thanks

Syed Haider Ali


--
Syed Haider Ali
------------------------------------------------------------------------
Syed Haider Ali's Profile: http://www.excelforum.com/member.php...o&userid=21994
View this thread: http://www.excelforum.com/showthread...hreadid=515923

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Copy Problem

#1 sounds like a data type issue...try checking to see if the value of the
referenced cell in numeric before checking to see if it fits the criteria of
the copy loop...i.e:

Private Sub CommandButton1_Click()
Dim x As Long
Dim y As Long
y = 1
For x = 1 To 65536
If isNumeric(Cells(x,1).Value) = true then
If Cells(x, 1).Value =1245 And Cells(x, 1).Value <= 2000 Then
Cells(x, 1).EntireRow.Copy
Sheets("sheet2").Cells(y, 1).PasteSpecial
y = y + 1
End If
End If
Next x
Application.CutCopyMode = False
End Sub


"Syed Haider Ali" wrote:


Dear Friends,

I have the following codes to copy specific data from one sheet to
another

Private Sub CommandButton1_Click()
Dim x As Long
Dim y As Long
y = 1
For x = 1 To 65536
If Cells(x, 1).Value =1245 And Cells(x, 1).Value <= 2000 Then
Cells(x, 1).EntireRow.Copy
Sheets("sheet2").Cells(y, 1).PasteSpecial
y = y + 1
End If
Next x
Application.CutCopyMode = False
End Sub

1. Col A of active sheet has numeric values which are copied from
1245 to 2000 in Sheet2. If Col A contains Date values then above codes
does not work. How can I overcome the problem ?

2. If I create a temp worksheet through userform and then copy from
one sheet to tempws then these codes does not work.

The code for creating temp worksheet are as

Private sub userform_activate()

Dim tempws as worksheet
Set tempws = Thisworkbook.worksheets.add
Tempws.name = €śTemp€ť

End sub

How I can overcome the above two problems

Thanks

Syed Haider Ali


--
Syed Haider Ali
------------------------------------------------------------------------
Syed Haider Ali's Profile: http://www.excelforum.com/member.php...o&userid=21994
View this thread: http://www.excelforum.com/showthread...hreadid=515923


Reply
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
Copy Problem WTG Excel Discussion (Misc queries) 3 March 23rd 07 10:14 PM
copy problem WTG Excel Worksheet Functions 2 March 23rd 07 09:50 PM
Copy Problem sharpie23 Excel Programming 0 October 31st 05 09:06 PM
Copy problem again. Peter[_28_] Excel Programming 4 November 6th 04 12:20 PM
copy problem Mark K[_3_] Excel Programming 2 February 26th 04 06:11 PM


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