ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   HELP! (https://www.excelbanter.com/excel-programming/329570-help.html)

Lacy Hall

HELP!
 
I'm trying to write a macro to look at dates and print each different date to
another sheet in another workbook. I'm not that great with vb code so I need
some help. Here's what I have.

Dim str As Workbook
Dim mon As Workbook

Workbooks.OpenText Filename:="C:\Documents and
Settings\lahall\Desktop\monthly"

Set str = Workbooks("Scrap Trend Report experiment.xls")
Set mon = Workbooks("monthly.xls")

For L = 1 To 2000
'This is the line that comes up in the debug'
If str.Worksheets("data").Cells(1, L) <
str.Worksheets("data").Cells(1, L + 1) Then
For B = 1 To 5
str.Worksheets("data").Cells(1, L).Copy
Destination:=mon.Worksheets("sheet2").Cells(1, B)
Next B
End If
Next L

Thanks,
Lacy


All times are GMT +1. The time now is 10:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com