+ Reply to Thread
Results 1 to 5 of 5

Want to clear contents also from left column

Hybrid View

HaroonSid Want to clear contents also... 04-15-2014, 06:16 AM
patel45 Re: Want little changing in... 04-15-2014, 07:11 AM
zbor Re: Want little changing in... 04-15-2014, 07:12 AM
HaroonSid Re: Want to clear contents... 04-15-2014, 07:35 AM
HaroonSid Re: Want to clear contents... 04-16-2014, 02:31 AM
  1. #1
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,095

    Post Want to clear contents also from left column

    hello
    i want to little change in below code
    in below code i want to delete also left column data

    Set RClear = cl.End(xlToRight)
    Set RClear = cl.End(xlToLeft)



    thanx a lot
    Option Explicit
     
    Sub ClearContents()
        Dim cl As Range, rCol As Range, RClear As Range
        Set rCol = Range("C2:C6", Range("C6").End(xlUp))
        Application.ScreenUpdating = False
        For Each cl In rCol
            If cl.Value = 0 Then
                Set RClear = cl.End(xlToRight)
                cl.ClearContents 'you can delete this to keep the formula
                RClear.ClearContents
                
            End If
        Next cl
        Application.ScreenUpdating = True
         
    End Sub
    Last edited by HaroonSid; 04-15-2014 at 07:34 AM.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Want little changing in code

    Sub ClearContents()
        Dim cl As Range, rCol As Range, RClear As Range
        Set rCol = Range("C2:C6", Range("C6").End(xlUp))
        rCol.Select
        Application.ScreenUpdating = False
        For Each cl In rCol
            If cl.Value = 0 Then
                Set RClear = cl.End(xlToRight)
                Set RClear1 = cl.End(xlToLeft)
                cl.ClearContents 'you can delete this to keep the formula
                RClear.ClearContents
                RClear1.ClearContents
            End If
        Next cl
        Application.ScreenUpdating = True
         
    End Sub
    If solved remember to mark Thread as solved

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,028

    Re: Want little changing in code

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Never use Merged Cells in Excel

  4. #4
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,095

    Re: Want to clear contents also from left column

    Hello MOD zbor

    i have changed the poor title.

    thanx for the remind me

    best regards
    haroon2015

  5. #5
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,095

    Re: Want to clear contents also from left column

    Thanx Alot patel45

    working perfect

    will add +1 repu

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Changing static code to dynamic code
    By JamesFletcher in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-14-2013, 07:31 AM
  2. Need help changing code to use a different column
    By luke.guthrie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-18-2012, 12:39 PM
  3. changing a code
    By alpertheidiot in forum Excel General
    Replies: 1
    Last Post: 06-15-2009, 05:46 AM
  4. Changing this code
    By Neal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-12-2006, 06:55 PM
  5. Help with changing code
    By Greg B in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-13-2005, 12:06 AM

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