+ Reply to Thread
Results 1 to 3 of 3

Macro to delete data for the cells specified

  1. #1
    Registered User
    Join Date
    07-15-2013
    Location
    hyderabad
    MS-Off Ver
    Excel 2007
    Posts
    10

    Macro to delete data for the cells specified

    hi all,

    i wrote a macro to store the output in a worksheet based on dropdown selection. if i selects one value from dropdown the macro is getting trigered and the data is getting stored in a worksheet from the 5th cell value if i selects another value from dropdown the corresponding macro is getting triggered and the output generated is getting stored in the same worksheet by overriding the first output data .my output worksheet for 2 dropdown values is same so before overiding the data i want to clear the data from worksheet which is previously their in the worksheet. wat piece of code should i include..?

    wat piece of code should i include in order to clear the data before storing data in the worksheet from 5th cell


    regards,
    Saikumar.

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Macro to delete data for the cells specified

    Hello balu.vasa,

    It would depend on what you have, and what the code looks like. Maybe if you could upload a sample Workbook complete with your VBA project, to take out a lot of guessing, would make it much easier for us to promptly give you a ready solution.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Registered User
    Join Date
    07-15-2013
    Location
    hyderabad
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Macro to delete data for the cells specified

    hi ,

    iam unable to load the file

    he is my logic
    Sub plan1()
    Dim wb3 As Workbook
    Dim wksplan As Worksheet
    Dim sh, sh1, sh2 As String
    Dim count, i, j, k As Integer
    count = 0
    Set wb3 = Workbooks.Open("C:\Users\SONY-VAIO\Desktop\tracker\Jan.xlsx", True, True)
    Set wksplan = wb3.Sheets(1)
    Set wb4 = ThisWorkbook.Sheets(1)
    k = 5
    For i = 2 To 264
    sh = wksplan.Cells(i, 2).Value
    count = 0
    For j = 9 To 45
    sh1 = wksplan.Cells(i, j).Value
    If sh1 = "Unplanned Leave" Then
    count = count + 1
    End If
    Next
    wb4.Cells(k, 1) = sh
    wb4.Cells(k, 2) = count
    k = k + 1
    Next
    End Sub

    the above logc will calculate the number of planned leaves count and the output will be stored in the same active worksheet from 5th cell onwards

    similarly i ran the similar logic but with some changes to above code for unplanned leaves.. so it will generate the output and will store in the same worksheet by overriding it.. i need a logic that will delete the data which is previously there in the active worksheet and will load the current output data to same worksheet

+ 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] Macro to delete blank cells and unwanted cells in a particular column
    By Nikkishr in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-09-2012, 06:22 PM
  2. macro to delete data from cells in all worksheets but 2
    By royboyy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-12-2008, 11:40 PM
  3. MACRO - Unmerge cells and delete blank columns, leaving data colum
    By Alex Sander in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-08-2006, 07:15 AM
  4. Macro or Formula to delete empty cells in a column of data
    By Cougar548 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-02-2005, 10:19 AM
  5. Macro to delete data in 'green' cells only
    By Steve in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-19-2005, 10: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