+ Reply to Thread
Results 1 to 14 of 14

delete 7 cells on each of the 35 sheets

Hybrid View

  1. #1
    Registered User
    Join Date
    08-12-2008
    Location
    BELLINGHAM
    Posts
    24

    delete 7 cells on each of the 35 sheets

    i am going to have 25 sheets for subcontractors in a construction magement workbook. i want to delete 7 cells on each of the 35 sheets. they will all be in the same place on all sheets. ex c7 g18 e14 etc on all 25 sheets. i was wondering if there is a way to create a function that can perform this operation. let me know if you got anything that might help.

  2. #2
    Forum Contributor Stuie's Avatar
    Join Date
    09-17-2006
    Location
    Suffolk, UK
    MS-Off Ver
    Excel 2003/2007
    Posts
    432
    Hi wwu-dillon,

    when you say delete the cells, do you mean clear their contents or delete the entire row or column??

    either way tho, you can write a macro that will loop through each sheet and proform this fairly easily.

    how many cells need clearing or deleting on each sheet?


    EDIT: sorry i didnt see the 7 cells part.

    can you list the 7 cells that need this and if they are to be deleted or cleared
    There are only 10 types of people in the world:
    Those who understand binary, and those who don't!

  3. #3
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    Add extra ranges to array

    Dim Arr As Variant
    Dim i As Long
    Dim Wsht As Worksheet
    Arr = Array("C7", "G18", "E14")
    
    
    For Each Wsht In Worksheets
        For i = 0 To UBound(Arr)
            Wsht.Range(Arr(i)).ClearContents
        Next i
    Next Wsht
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  4. #4
    Registered User
    Join Date
    08-12-2008
    Location
    BELLINGHAM
    Posts
    24
    the cells are as follows: E19, E52, E118, E151, E184, E217. i thought about naming each of them their own unique name (deleteme1-70 or so) and then using range find in the macro. if there is an easier way i would love it. they can be zeroed out or replaced with a 0. both ways or either way let me know. thanks alot.

  5. #5
    Forum Contributor Stuie's Avatar
    Join Date
    09-17-2006
    Location
    Suffolk, UK
    MS-Off Ver
    Excel 2003/2007
    Posts
    432
    wwu-dillon, i would personally go with what what VBA Noob said as that is the exact same thing i was going to suggest

  6. #6
    Registered User
    Join Date
    08-12-2008
    Location
    BELLINGHAM
    Posts
    24
    its a little confusing but i guess ill play around with it. im not trying to be difficult, this help is amazing and fast. but ill see what i can do. im almost done at work but will be back tomorrow to mess with it.

    edit: i will have many more sheets in the workbook so can i set an array for the worksheets, or does this make a big impact.

  7. #7
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Add the sheets to ignore on this line in lower case
    Case "SHEET1", "SHEET2"
    Dim Arr As Variant
    Dim i As Long
    Dim Wsht As Worksheet
    Arr = Array("C7", "G18", "E14")
    
    
    For Each Wsht In Worksheets
        Select Case UCase(Wsht.Name)
        Case "SHEET1", "SHEET2"
        '
        Case Else
            For i = 0 To UBound(Arr)
                Wsht.Range(Arr(i)).ClearContents
            Next i
        End Select
    Next Wsht
    VBA Noob

  8. #8
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561
    It's an array or it isn't...
     dim arr() as variant

  9. #9
    Registered User
    Join Date
    08-12-2008
    Location
    BELLINGHAM
    Posts
    24
    ok i think i got it working. im going to test it with data in the next few days and see how it goes. thank you all for your help.

    -dillon

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1