Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 63
Default Macro Modification Help

How can I modify the macro below so that it will paste everything starting
with Column B instead of column A? I have tried every combination I can
think of, but I couldn't get it to work.

Private Sub Workbook_Open()
lr = Application.Max(2, Cells(Rows.Count, 2).End(xlUp).Row)
'MsgBox lr
Rows("2:" & lr).ClearContents
With Workbooks("QIC.xls").Worksheets("Overturns_QIC")
slr = .Cells(Rows.Count, "c").End(xlUp).Row
'MsgBox slr
For i = 2 To slr
dlr = Cells(Rows.Count, "a").End(xlUp).Row + 1
' If .Cells(i, "y") = 30 Then .Rows(i).Copy Rows(dlr)
If .Cells(i, "y") = 30 And Not .Cells(i, "x") = "Paid" Then
..Rows(i).Copy Rows(dlr)
Next i
With Workbooks("FI.xls").Worksheets("Overturns_FI")
slr = .Cells(Rows.Count, "c").End(xlUp).Row
'MsgBox slr
For i = 2 To slr
dlr = Cells(Rows.Count, "a").End(xlUp).Row + 1
' If .Cells(i, "y") = 30 Then .Rows(i).Copy Rows(dlr)
If .Cells(i, "y") = 30 And Not .Cells(i, "x") = "Paid" Then
..Rows(i).Copy Rows(dlr)
Next i
End With
End With
End Sub

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Macro Modification Help

hi
this seems to be what is doing it.
Rows(i).Copy Rows(dlr)
you are coping an entire row and pasting and entire row.
if you try to shift left one cel, you will get a script out of range error
or something like that. and so long as you are coping an entire row, it will
always paste at "A".
you code give no indications as to how much data you need(wnat) to copy. and
without seeing our data, i can't really recomend anything specific.
generically you must copy only the range of data you wish then paste that at
"B"
range("somehting").copy cells(dlr,"B")

regards
FSt1


"akemeny" wrote:

How can I modify the macro below so that it will paste everything starting
with Column B instead of column A? I have tried every combination I can
think of, but I couldn't get it to work.

Private Sub Workbook_Open()
lr = Application.Max(2, Cells(Rows.Count, 2).End(xlUp).Row)
'MsgBox lr
Rows("2:" & lr).ClearContents
With Workbooks("QIC.xls").Worksheets("Overturns_QIC")
slr = .Cells(Rows.Count, "c").End(xlUp).Row
'MsgBox slr
For i = 2 To slr
dlr = Cells(Rows.Count, "a").End(xlUp).Row + 1
' If .Cells(i, "y") = 30 Then .Rows(i).Copy Rows(dlr)
If .Cells(i, "y") = 30 And Not .Cells(i, "x") = "Paid" Then
.Rows(i).Copy Rows(dlr)
Next i
With Workbooks("FI.xls").Worksheets("Overturns_FI")
slr = .Cells(Rows.Count, "c").End(xlUp).Row
'MsgBox slr
For i = 2 To slr
dlr = Cells(Rows.Count, "a").End(xlUp).Row + 1
' If .Cells(i, "y") = 30 Then .Rows(i).Copy Rows(dlr)
If .Cells(i, "y") = 30 And Not .Cells(i, "x") = "Paid" Then
.Rows(i).Copy Rows(dlr)
Next i
End With
End With
End Sub

Thanks!

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
macro - modification yshridhar Excel Discussion (Misc queries) 10 February 1st 08 03:47 AM
Macro Modification carl Excel Worksheet Functions 0 May 4th 07 04:17 PM
Macro Modification Carl Excel Worksheet Functions 2 August 30th 06 01:53 PM
Macro modification Hirsch Excel Discussion (Misc queries) 3 May 27th 05 10:21 PM
Macro Modification Help Dmorri254 Excel Worksheet Functions 0 March 4th 05 03:51 PM


All times are GMT +1. The time now is 05:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"