Guest User

immoscrap.xls

a guest
Apr 16th, 2012
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.58 KB | None | 0 0
  1.  
  2. Sub SetupPage(codePostal As String)
  3.     On Error Resume Next
  4.      bExisteFlle = Worksheets(codePostal).Name
  5.      If Err.Number = 9 Then
  6.           Err.Clear
  7.           ActiveWorkbook.Worksheets.Add
  8.           ActiveSheet.Name = codePostal
  9.        
  10.           ActiveSheet.Cells(1, 1) = "Annonce"
  11.           ActiveSheet.Cells(1, 2) = "Surface"
  12.           Columns("A:A").ColumnWidth = 10
  13.           Columns("B:B").ColumnWidth = 7
  14.           Rows("1:1").Font.Bold = True
  15.  
  16.     Else
  17.       Worksheets(codePostal).Activate
  18.     End If
  19.    
  20.     LastCol = ActiveSheet.UsedRange.Columns.Count
  21.     If Not IsDate(Cells(1, LastCol)) Then
  22.             LastCol = LastCol + 1
  23.     ElseIf Day(Cells(1, LastCol)) <> Day(Now) Or Month(Cells(1, LastCol)) <> Month(Now) Then
  24.             LastCol = LastCol + 1
  25.     End If
  26.    
  27.     Cells(1, LastCol) = Now
  28.     Cells(1, LastCol).NumberFormat = "dd/mm/yy"
  29. End Sub
  30.  
  31.  
  32. Sub AddLine(id As String, surface As String, price As String)
  33.  
  34.     LastCol = ActiveSheet.UsedRange.Columns.Count
  35.    
  36.     ShortId = Val(Split(id, "/")(2))
  37.     For ligne = 2 To ActiveSheet.UsedRange.Rows.Count
  38.         If Cells(ligne, 1) = ShortId Then
  39.             Cells(ligne, LastCol) = price
  40.             Cells(ligne, LastCol).NumberFormat = "#,##0 €"
  41.             Exit Sub
  42.         End If
  43.     Next ligne
  44.    
  45.     ActiveSheet.Hyperlinks.Add Anchor:=Cells(ligne, 1), _
  46.         Address:="http://www.seloger.com" & id, _
  47.         TextToDisplay:=Str(ShortId)
  48.  
  49.     Cells(ligne, 2) = surface
  50.    
  51.     Cells(ligne, LastCol) = price
  52.     Cells(ligne, LastCol).NumberFormat = "#,##0 €"
  53. End Sub
Advertisement
Add Comment
Please, Sign In to add comment