LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default I need help with 2 Questions


::Q1) An error message comes up when I run the code below, ::
::Error message: “compile error, next without for” the highlight area
is (Next wks) right at the bottom of the code in-between (END WITH & END
SUB) can someone fix it::
::Q2) Instead of the code below running on every sheet can someone make
it skip the first 5 sheets using a sheet.count formula please?::

::Option Explicit::
::Sub NewRow()::

::Dim EndRowA As Long::
::Dim NextRowAF As Long::
::Dim wks As Worksheet::
::Dim iRow As Long::

::For Each wks In ActiveWorkbook.Worksheets::
::With wks::
::EndRowA = Cells(.Rows.Count, \"A\").End(xlUp).Row::
::NextRowAF = .Cells(.Rows.Count, \"AF\").End(xlUp).Row + 1::
::.Cells(NextRowAF, \"AC\").Value = \"Total\"::
::.Cells(NextRowAF, \"AF\").Formula _::
::= \"=sum(AF5:AF\" & NextRowAF - 1 & \")\"::
::With Union(.Cells(NextRowAF, \"AF\"), .Cells(NextRowAF, \"AC\"))::
::With Union(.Cells(NextRowAF, \"AF\"), .Cells(NextRowAF, \"AD\"))::
::With Union(.Cells(NextRowAF, \"AF\"), .Cells(NextRowAF, \"AE\"))::
::.Font.Bold = True::
::.Font.ColorIndex = 2::
::.Interior.ColorIndex = 32::
::.Borders.LineStyle = xlContinuous::
::.Borders.ColorIndex = 2::
::.Borders.Weight = xlThin::
::End With::

::For iRow = NextRowAF + 1 To 32::
::If Application.CountA(.Rows(iRow)) = 0 Then::
::.Rows(iRow).Interior.ColorIndex = 2::
::End If::
::Next iRow::

::.Rows(\"5:32\").RowHeight = 12.75::
::End With::
::Next wks::
End Sub


--
Aussiegirlone
------------------------------------------------------------------------
Aussiegirlone's Profile: http://www.thecodecage.com/forumz/member.php?userid=272
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=116530

 
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
2 questions. CelticCharmer Excel Discussion (Misc queries) 4 November 2nd 08 04:33 PM
View Questions and Answer to questions I created Roibn Taylor Excel Discussion (Misc queries) 4 July 24th 08 12:05 AM
3 Questions Django Cat[_2_] Excel Discussion (Misc queries) 16 November 12th 07 10:30 PM
2 Questions Rich Stanek Excel Worksheet Functions 1 June 7th 07 09:43 AM
2 questions Sally Sibthorpe Charts and Charting in Excel 9 July 26th 06 10:15 PM


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

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"