PDA

View Full Version : Macro programming for the uploaded word document


swaroopa
Aug 7, 2009, 07:07 AM
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!!

JBeaucaire
Aug 7, 2009, 12:32 PM
No attachments. Try zipping the file first, then upload it again.

swaroopa
Aug 7, 2009, 06:14 PM
Thank yoy, I am uploading the Zip file..

swaroopa
Aug 7, 2009, 06:18 PM
Hello Sir,

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

I am pleased to hear from you.

Thanking you,
Swaroopa.

JBeaucaire
Aug 7, 2009, 07:02 PM
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.


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