LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Filling down problem in VB

The following piece of code allows me to enter a new row
in exactly the same position on multiple sheets, it then
copies down the data from the above row - therefore
maintaing all formulae.
However, is it possible to specify which cells from above
eg columns A, B, and D need to be filled down, but not C
and E?



Private Sub CommandButton1_Click()




Dim wks As Worksheet

Dim l_Row As Long
Dim rng As Range

ActiveCell.Select
l_Row = ActiveCell.Row


If l_Row = ActiveSheet.Rows.Count Then
MsgBox "Can't add any more rows!"
Exit Sub
ElseIf l_Row = 6 Then
MsgBox "Can't fill down from above row 6."
Exit Sub
End If



For Each wks In ThisWorkbook.Worksheets

If wks.Name = "Year Summary 02-03" _
Or wks.Name = "Year Summary 03-04" _
Or wks.Name = "Budgeted Hours" _
Or wks.Name = "Associates Hours (actuals)" _
Or wks.Name = "Directors Hours (actuals)" _
Or wks.Name = "Invoices (actuals)" _
Or wks.Name = "Project Costs" _
Or wks.Name = ActiveSheet.Name Then

Set rng = wks.Cells(l_Row, 1).EntireRow

rng.Insert

rng.Offset(-1, 0).FillDown

End If
Next


End Sub
 
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
Filling down Officeteacher Excel Discussion (Misc queries) 5 February 22nd 10 08:29 PM
problem filling in blank cells with data above - stumped-in-excel[_2_] Excel Discussion (Misc queries) 1 July 6th 09 10:10 PM
filling information from one cell and filling another. Dianne Excel Worksheet Functions 1 August 15th 05 08:14 PM
Zero Filling Excel Discussion (Misc queries) 4 December 17th 04 08:46 PM
filling greg Excel Programming 2 February 20th 04 04:28 AM


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