Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Spreadsheets (https://www.askmehelpdesk.com/forumdisplay.php?f=395)
-   -   Macro programming for the uploaded word document (https://www.askmehelpdesk.com/showthread.php?t=384352)

  • Aug 7, 2009, 07:07 AM
    swaroopa
    Macro programming for the uploaded word document
    Hello Sir,

    I am new to write a macro program in Excel 2003. Could you please help me out with macro programming?

    I am attaching a word document in that document I gave all the snap shots of my excel and please go through the document and help me out.

    Note: when I pressed the insert button it went into other window there I have uploaded my word document.

    Thank you for the help in advance:)

    Have a nice time!!
  • Aug 7, 2009, 12:32 PM
    JBeaucaire

    No attachments. Try zipping the file first, then upload it again.
  • Aug 7, 2009, 06:14 PM
    swaroopa
    Thank yoy, I am uploading the Zip file..
  • Aug 7, 2009, 06:18 PM
    swaroopa
    1 Attachment(s)
    Macro situation in word document
    Hello Sir,

    I am uploading the word document . Please go through the situation.

    I am pleased to hear from you.

    Thanking you,
    Swaroopa.
  • Aug 7, 2009, 07:02 PM
    JBeaucaire

    I suspect you may be greatly oversimplifying this scenario, but if it's truly as simply as "find Kostenart" and "thj" and delete everything else around it, that's pretty simple.

    Code:

    Option Explicit

    Sub TwoColumnsOnly()
    Dim v1 As Long, v2 As Long, FR As Long

    Cells.Find(What:="Kostenart", LookIn:=xlValues, LookAt:=xlWhole).Activate
    Range("A1:A" & ActiveCell.Row - 1).EntireRow.Delete (xlShiftUp)

    If ActiveCell.Column > 1 Then _
        Range("A1", Cells(1, ActiveCell.Column - 1)).EntireColumn.Delete (xlShiftToLeft)
       
    Cells.Find(What:="Kostenart", LookIn:=xlValues, LookAt:=xlWhole).Activate
    v1 = ActiveCell.Column + 1
    Rows(1).Find(What:="thj", LookIn:=xlValues, LookAt:=xlWhole).Activate
    v2 = ActiveCell.Column - 1

    Range(Cells(1, v1), Cells(1, v2)).EntireColumn.Delete (xlShiftToLeft)
    Rows(1).Delete (xlShiftUp)
    End Sub


  • All times are GMT -7. The time now is 10:40 AM.