anilsharaf
New Member
- Joined
- Apr 8, 2014
- Messages
- 43
- Office Version
- 2007
- Platform
- Windows
In sheet ePay Column A there are month Names of the Finencial Year. Mar-21 to Jan-22. I tried several code snippests but my code fails in the loop. Window7, Excel 2007, Date system Date Formate is United Kingdom short date dd/mm/yy Long date formate is dd-mmmm-yyyy. I used the codes: when I do this in User Interface Find all works. The sheet is a downloaded sheet from ePay Database. Actually I have to retrive data from many sheets. I have done this locating the DDOCode 62014 in Column A (A25). But some times it is not available. But the Pay of Month is always there. So I want to retrive the data locating cell in which Pay of Months are entered.
I would be greatful for your help. Thanks in advance.
The Code is:
The Mini Sheet is:
I would be greatful for your help. Thanks in advance.
The Code is:
VBA Code:
Sub XX_Failed_XXDateBasedSearchWriteAmountToSheet_MyCopiedData()
NextEmployeeRow = 11
LastRow = ActiveSheet.UsedRange.Rows.Count - 4
1 'read the number of employees from sheet finding "Dates in mmm-yy Format"
With ActiveSheet.Range("A" & NextEmployeeRow & ":A" & LastRow)
'Search is based on Date Formate of Sheet
Application.FindFormat.Clear
Application.FindFormat.NumberFormat = "mmm-yy"
Set cell = .Find(What:="", LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=True)
x = cell
If Not cell Is Nothing Then
firstAddress = cell.Address
NextEmployeeRow = Range(cell.Address).Row + 1
Do
TotalEntries = TotalEntries + 1
EmId = Range(cell.Address).Offset(-2, 1)
EmNm = Range(cell.Address).Offset(2, 1)
'Range(cell.Address).Offset(-3, 1).Resize(7, 13).Select
'cell.Value = 5
Set cell = .FindNext
x = cell
Loop While Not cell Is Nothing And cell.Address <> firstAddress
End If
End With
end sub
Book1 | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | |||
11 | Sr.No. | Basic | StagnationInc | Trans.Allow. | WashingAllow | Sp.PoliceAllow | Conn.Ch.Allow | WaterAllow | GrossSalary | GPF/DPF/Tier1 | GrainRec | GIS | TotalDedn. | |||
12 | EmployeeID | D.Pay | InterimRelief | Depu.Allow | CashierAllow | BigularAllow | SpecialAllow | NewsPrAllow | G/DPF/CPS.Rc | ComputerRec | PLI | NetSalary | ||||
13 | EmployeeCode | GradePay | OtherPay | TribalAllow | OtherAllow | MedalAllow | RobeAllow | Mag.Allow | HB.Rec | PayRec | HouseRent | |||||
14 | Pay Month Year | PF/PRAN NO. | NPA | D.A. | HRA | Wages | ArmourAllow | SumptAllow | Elec.Allow | CarRec | OtherRec | WaterCharge | ||||
15 | Salary Taken DDO | BankA/C | SpecialPay | AdditionalDA | ProjectAllow | FixTA | DIAllow | LibAllow | Sec.Allow | CycleRec | IncomeTax | Mot.Vec.Char | ||||
16 | Name | PersonalPay | Fee | TrainingAllow | P.AaharAllow | UniformAllow | TeleAllow | - | MotorCycleRec | Prof.Tax | OtherDed | |||||
17 | Honorarium | CCA | MedicalAllow | Sp.RationAllow | MT.Allow | H.O.Allow | - | FestivalRec | FBF | Ex.PayRec | ||||||
18 | ||||||||||||||||
19 | ||||||||||||||||
20 | Designation :Regular Peon, No. of Post :2, Wide Sanction Order No. and Date :F/44/Fin/,- | |||||||||||||||
21 | 1 | 23600 | 0 | 0 | 50 | 0 | 0 | 0 | 27310 | 2643 | 0 | 180 | 2823 | |||
22 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 24487 | ||||
23 | 6200140030 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |||||
24 | Mar-21 | 1.1001E+11 | 0 | 2832 | 628 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||||
25 | 620014 | 11502540831 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||||
26 | Marina | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |||||
27 | 0 | 0 | 200 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||||||
28 | ||||||||||||||||
29 | ||||||||||||||||
30 | 2 | 23600 | 0 | 0 | 50 | 0 | 0 | 0 | 27310 | 2643 | 0 | 180 | 3610 | |||
31 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 23700 | ||||
32 | 6200140030 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |||||
33 | Apr-21 | 1.1001E+11 | 0 | 2832 | 628 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||||
34 | 620014 | 11502540831 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||||
35 | Marina | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 787 | |||||
36 | 0 | 0 | 200 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||||||
37 | ||||||||||||||||
38 | ||||||||||||||||
39 | 3 | 23600 | 0 | 0 | 50 | 0 | 0 | 0 | 27310 | 2643 | 0 | 180 | 2823 | |||
40 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 24487 | ||||
41 | 6200140030 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |||||
42 | May-21 | 1.1001E+11 | 0 | 2832 | 628 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||||
43 | 620014 | 11502540831 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||||
44 | Marina | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |||||
45 | 0 | 0 | 200 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||||||
46 | ||||||||||||||||
47 | ||||||||||||||||
48 | 4 | 23600 | 0 | 0 | 50 | 0 | 0 | 0 | 27310 | 2643 | 0 | 180 | 2823 | |||
49 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 24487 | ||||
50 | 6200140030 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |||||
51 | Jun-21 | 1.1001E+11 | 0 | 2832 | 628 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||||
52 | 620014 | 11502540831 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||||
53 | Marina | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |||||
54 | 0 | 0 | 200 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ||||||
ePay1 |