# can ypou please write vba code

• ### Question

• hi frds,

Pls go-through the attachment and develop the task .and send as a macro file to this e mail:yrameshgautam@gmail.com

1. Split the input data based on Country column. Move that segregated data into separate sheets. Each sheet name should have corresponding Country name.
2. Split (-) in PR.
3. Add one column for sum the Total Spend Column based on Combination, Net.(Use SUMIF formula)
4. Put lookup – Add Desciption column after Numbe Column. Lookup from Master1 if not available then lookup from Master2  sheet
5. Add one column for – calculating (current year Spend –Previous Year Spend)/Previous Year Spend) for Each Quarter.
6. Select Zero(0) Values in all spend column and delete that data.
7. Change the Start and End date Column format as  (dd/mm/yyyy)
8. Calculate Network days from Start and End Date.
9. Sort data based on Total Spend – Largest to Smallest
10. Put Pivot  - Total Spend column based on Number and Country Combination

pls help me

• Edited by Saturday, June 28, 2014 12:41 PM
Monday, March 3, 2014 7:33 AM

### All replies

• Sub SelectLastCellInRange()

Dim TheRange As Range

Dim LastRow As Long
Dim LastCol As Long

Set TheRange = Selection

With TheRange
LastRow = .Row + .Rows.Count - 1
LastCol = .Column + .Columns.Count - 1
End With

Cells(LastRow, LastCol).Select

Set TheRange = Nothing

End Sub

Guy Zommer

Monday, March 3, 2014 12:34 PM
• If its selected use this:

Dim intLastRow As Integer
intLastRow = Str(Selection.Rows.Count + Selection.Row - 1)

If its a range use this:

Dim intLastRow As Integer
'where objRange is the range in question
intLastRow = Str(objRange.Rows.Count + objRange.Row - 1)

VBA Programming Service
Monday, March 3, 2014 2:33 PM
• Please take a look at this.

http://www.mrexcel.com/td0058.html

Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

Friday, May 2, 2014 2:05 PM