irfananeeza
Active Member
- Joined
- Feb 15, 2008
- Messages
- 334
- Office Version
- 2010
Folks,
I've build the following code. It runs thru okay with sort. But gives trouble when get to ".Columns..." line. What am I doing wrong here.?
Sub macro()
With Range("A2:J5000")
.Sort key1:=Range("A2"), Order1:=xlAscending, _
Header:=xlGuess, Ordercustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, dataoption1:=xlSortNormal
.Columns(1).Find(what:="Non-ILEC", LookAt=xlWhole)
End With
End Sub
Secondly,
I build this code, it works perfectly. But can someone please have a look and show me how it can be rewritten with less code lines. Basically, I want to insert 3 lines and type total and sum value.
Sub macro()
Columns(1).Find(what:="Non-ILEC", LookAt:=xlWhole).EntireRow.Insert
Columns(1).Find(what:="Non-ILEC", LookAt:=xlWhole).EntireRow.Insert
Columns(1).Find(what:="Non-ILEC", LookAt:=xlWhole).EntireRow.Insert
Columns(1).Find(what:="Non-ILEC", LookAt:=xlWhole).Offset(-2).Value = "Total BS ILEC Orders"
End Sub
Thirdly,
Can I use excel sum function in vba? if not...what is the alternative.?
How would I total "Total BS ILEC Orders" when the "Amount" column is G.
I've build the following code. It runs thru okay with sort. But gives trouble when get to ".Columns..." line. What am I doing wrong here.?
Sub macro()
With Range("A2:J5000")
.Sort key1:=Range("A2"), Order1:=xlAscending, _
Header:=xlGuess, Ordercustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, dataoption1:=xlSortNormal
.Columns(1).Find(what:="Non-ILEC", LookAt=xlWhole)
End With
End Sub
Secondly,
I build this code, it works perfectly. But can someone please have a look and show me how it can be rewritten with less code lines. Basically, I want to insert 3 lines and type total and sum value.
Sub macro()
Columns(1).Find(what:="Non-ILEC", LookAt:=xlWhole).EntireRow.Insert
Columns(1).Find(what:="Non-ILEC", LookAt:=xlWhole).EntireRow.Insert
Columns(1).Find(what:="Non-ILEC", LookAt:=xlWhole).EntireRow.Insert
Columns(1).Find(what:="Non-ILEC", LookAt:=xlWhole).Offset(-2).Value = "Total BS ILEC Orders"
End Sub
Thirdly,
Can I use excel sum function in vba? if not...what is the alternative.?
How would I total "Total BS ILEC Orders" when the "Amount" column is G.