Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default Useing IF to Paste a Range

HI ALL

I get here {in this community} a very usefull help for me with a
Macro;
I needed a macro to delete a ,,specific range,, in every Row,
if the value from BD91 to BD 65536 <=32 ;
here is the macro :


Sub Clear_Ranges()


' Macro recorded 3/5/2008 by Tim


Dim cell As Range, rng As Range
Set rng = Range(Cells(91, "BD"), Cells(Rows.Count,
"BD").End(xlUp))
For Each cell In rng
If cell.Value <= 32 Then
Cells(cell.Row, "C").Select
Selection.Resize(1, 52).Select
Selection.ClearContents
End If
Next
End Sub

It works perfect , but it take in my database [of 231 workbooks]
a looonger ... time ,even this macro find in the same range {BD91 to
BD65536} the Value =33 , and then Copy this EntireRow in another Wo
rkbook ; I tried so :


Sub Clear_Ranges()
' Macro recorded 3/5/2008 by Tim

Dim cell As Range, rng As Range
Set rng = Range(Cells(91, "BD"), Cells(Rows.Count,
"BD").End(xlUp))
For Each cell In rng
If cell.Value = 33 Then {here maybe must be EntireRow .Select}
Cells(cell.Row, "C").Select
Selection.Resize(1, 52).Select
Selection.Copy
Windows("R1.xls").Activate
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
Windows("YTA1.xls").Activate
End If
Next

End Sub


.......but it didn't work ;{particular informations : both
workbooks named YTA1 and R1 are open ;R1 is the
basic workbook which get the results I need from
the others workbooks;in this case I want to select
and copy in wb R1 the EntireRow of the other wb
if the value in this Rows in Column BD is =33 }

Respectfully to ALL
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default Useing IF to Paste a Range

[this topic is not the same with ,,Useing IF to Delete a Range "],
here must be done a little change in this macro , but ...how ?..
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 124
Default Useing IF to Paste a Range

try this:

Sub Clear_Ranges()

dim calc_mode as long
calc_mode=application.calculation
application.calculation=xlcalculationmanual
Application.ScreenUpdating = False

Dim cell As Range, rng As Range
Set rng = Range(Cells(91, "BD"), Cells(Rows.Count, "BD").End(xlUp))
For Each cell In rng
If cell.Value <= 32 Then Cells(cell.Row, "C").ClearContents
Next cell

application.calculation=calc_mode

End Sub


turning off screenupdating and calculation should make it run dramatically
faster. please don't hijack my thread anymore.

"ytayta555" wrote:

HI ALL

I get here {in this community} a very usefull help for me with a
Macro;
I needed a macro to delete a ,,specific range,, in every Row,
if the value from BD91 to BD 65536 <=32 ;
here is the macro :


Sub Clear_Ranges()


' Macro recorded 3/5/2008 by Tim


Dim cell As Range, rng As Range
Set rng = Range(Cells(91, "BD"), Cells(Rows.Count,
"BD").End(xlUp))
For Each cell In rng
If cell.Value <= 32 Then
Cells(cell.Row, "C").Select
Selection.Resize(1, 52).Select
Selection.ClearContents
End If
Next
End Sub

It works perfect , but it take in my database [of 231 workbooks]
a looonger ... time ,even this macro find in the same range {BD91 to
BD65536} the Value =33 , and then Copy this EntireRow in another Wo
rkbook ; I tried so :


Sub Clear_Ranges()
' Macro recorded 3/5/2008 by Tim

Dim cell As Range, rng As Range
Set rng = Range(Cells(91, "BD"), Cells(Rows.Count,
"BD").End(xlUp))
For Each cell In rng
If cell.Value = 33 Then {here maybe must be EntireRow .Select}
Cells(cell.Row, "C").Select
Selection.Resize(1, 52).Select
Selection.Copy
Windows("R1.xls").Activate
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
Windows("YTA1.xls").Activate
End If
Next

End Sub


.......but it didn't work ;{particular informations : both
workbooks named YTA1 and R1 are open ;R1 is the
basic workbook which get the results I need from
the others workbooks;in this case I want to select
and copy in wb R1 the EntireRow of the other wb
if the value in this Rows in Column BD is =33 }

Respectfully to ALL

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default Useing IF to Paste a Range

HI ryan

my apologise again ,
thank very much for help ;

the problem is to copy entire row in wbook R1 ,
if you'll have time toread again you'll understand ;
the problem with clear contents is resolved ;
the problem is that Macro must activate wbook
R1 and copy entire row in this wb , then come back
in wbook YTA1 and continue the search ,loop again
the value =33 in BD91:BD65536 ,when find it again
activate wbook R1 and so on ; the problem is to copy and
paste entire row , not to clear contents .

Respectfully
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
INDEX useing Dynamic Range Vic Waller Excel Worksheet Functions 4 August 11th 09 03:17 AM
Return while useing CONCATENATE Pierre Excel Discussion (Misc queries) 3 April 9th 09 03:59 PM
Useing If to Delete a Range ytayta555 Excel Programming 10 March 5th 08 11:45 PM
Email from Excel useing FollowHyperLink Jason Hanson[_2_] Excel Programming 0 August 24th 05 10:02 PM
useing arrows to move carman Excel Discussion (Misc queries) 1 December 20th 04 04:38 AM


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