Marco Bug

tygrl510

Board Regular
Joined
Feb 9, 2009
Messages
54
<table border="0" cellpadding="0" cellspacing="0" width="1493"><col style="width: 140pt;" width="186"><col style="width: 179pt;" width="239"><col style="width: 45pt;" width="60"><col style="width: 63pt;" span="7" width="84"><col style="width: 63pt;" span="2" width="84"><col style="width: 63pt;" span="3" width="84"><tbody><tr style="height: 12.75pt;" height="17"><td class="xl63" style="height: 12.75pt; width: 140pt;" height="17" width="186">Hi, I need help trying to decode this macro:

I have several sheets similar to the one below. Each sheet has 66rowsx15 columns. 19 Sheets.
</td><td class="xl63" style="width: 179pt;" width="239"></td><td class="xl63" style="width: 45pt;" width="60"></td><td class="xl67" style="width: 63pt;" width="84"></td><td class="xl67" style="width: 63pt;" width="84"></td><td class="xl67" style="width: 63pt;" width="84"></td><td class="xl67" style="width: 63pt;" width="84"></td><td class="xl67" style="width: 63pt;" width="84"></td><td class="xl67" style="width: 63pt;" width="84"></td><td class="xl67" style="width: 63pt;" width="84"></td><td class="xl67" style="width: 63pt;" width="84"></td><td class="xl67" style="width: 63pt;" width="84"></td><td class="xl67" style="width: 63pt;" width="84"></td><td class="xl67" style="width: 63pt;" width="84"></td><td class="xl67" style="width: 63pt;" width="84"></td></tr><tr style="height: 12.75pt;" height="17"><td class="xl63" style="height: 12.75pt;" height="17"></td><td class="xl64"></td><td class="xl63"></td><td class="xl65"></td><td class="xl65"></td><td class="xl65"></td><td class="xl65"></td><td class="xl65"></td><td class="xl65"></td><td class="xl65"></td><td class="xl65"></td><td class="xl65"></td><td class="xl65"></td><td class="xl65"></td><td class="xl65">
Excel Workbook
ABCDEF
1CATEGORY08CATEGORY09CC03AprMayJun
2040_Share Based Compensation0400_Option ExpenseSLSMGMT262626
SLSMGMT
Excel 2007
Cell Formulas
RangeFormula
D2='T:\Finance\RTY\FY12 Budget\[FY12 BESA_BIF BUDGET (SUB3).xlsx]SLSMGMT'!I$12
E2='T:\Finance\RTY\FY12 Budget\[FY12 BESA_BIF BUDGET (SUB3).xlsx]SLSMGMT'!J$12
F2='T:\Finance\RTY\FY12 Budget\[FY12 BESA_BIF BUDGET (SUB3).xlsx]SLSMGMT'!K$12



I have this macro:
Sub movedata()
Dim LR As Long, LR2 As Long, LC As Long, Ctr As Long, NR As Long, ToMove As Long, RptLR As Long
On Error Resume Next
Sheets("Report").Select
If Err Then Worksheets.Add.Name = "Report"
On Error GoTo 0
With Sheets("Report")
Dim wks As Worksheet
Application.ScreenUpdating = False
Sheets(1).Select
On Error Resume Next
Sheets("Report").Select
If Err Then Worksheets.Add.Name = "Report"
On Error GoTo 0
End With
With Sheets("Report")
.Range("A1").Resize(, 5).Value = [{"Cat07","Cat08","CC02","Month","Amount"}]
RptLR = .Cells(Rows.Count, 1).End(xlUp).Row
If RptLR > 1 Then
.Range("A2:Z" & RptLR).ClearContents
End If
End With
For Each wks In ThisWorkbook.Worksheets
If wks.Name<> "Instructions" And wks.Name<> "Report" Then
With wks
.Select
LC = .Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByColumns).Column
LR = .Cells(Rows.Count, 1).End(xlUp).Row
.Cells(1, LC + 2).Resize(, 5).Value = [{"Cat08","Cat09","CC02","Month","Amount"}]
ToMove = LC - 1
For Ctr = 2 To LR Step 1
NR = .Cells(Rows.Count, LC + 2).End(xlUp).Row
.Range("A" & Ctr).Copy .Range(Cells(NR + 1, LC + 2), Cells(NR + ToMove - 2, LC + 2))
.Range("B" & Ctr).Copy .Range(Cells(NR + 1, LC + 3), Cells(NR + ToMove - 2, LC + 3))
.Range("C" & Ctr).Copy .Range(Cells(NR + 1, LC + 4), Cells(NR + ToMove - 2, LC + 4))
.Range(Cells(1, 4), Cells(1, LC)).Copy
With .Cells(NR + 1, LC + 5)
.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
End With
.Range(Cells(Ctr, 4), Cells(Ctr, LC)).Copy
With .Cells(NR + 1, LC + 6)
.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
End With
Next Ctr
LR2 = .Cells(Rows.Count, LC + 2).End(xlUp).Row
RptLR = Sheets("Report").Cells(Rows.Count, 1).End(xlUp).Row
.Range(Cells(2, LC + 2), Cells(LR2, LC + 10)).Copy Sheets("Report").Range("A" & RptLR + 1)
.Range(Cells(1, LC + 2), Cells(LR2, LC + 100)).ClearContents
.Range("A1").Select
Application.CutCopyMode = False
End With
End If
Next wks
Sheets("Report").Select
RptLR = Cells(Rows.Count, 1).End(xlUp).Row
Range("A1:Z" & RptLR).Columns.AutoFit
Range("I1").Select
Application.ScreenUpdating = True

End Sub

The file is linked to a separate file within the same folder. Everytime I run the macro it opens up a window to open a file..each time i have to press cancel..and when I press cancel, it pops up again.

Can someone help?

Thanks in advance!!
tygrl510
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
There would appear to be a problem with the formula's you posted near the start of your question; the file referenced in those formulae are missing, check they still exist and in the correct location.
 
Upvote 0
Hi..

I didn't move the file. The file has not been renamed and still resides in the same location.

Thanks..
 
Upvote 0
What lines makes the files open window open? F8 line-by-line through your code and indentify that first.
 
Upvote 0

Forum statistics

Threads
1,222,239
Messages
6,164,784
Members
451,915
Latest member
Aminsha143

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top