LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default newbie, vba simple prg from a book doesn't write...see vlookup with vba?

Try then following.
-Merjet

Sub InsertRepresentativesInitials()
Dim ClasseurRep As Workbook
Dim Numdpt As String
Dim Colonne As Variant
Dim c As Range
Dim iEnd As Long

Set ClasseurRep = Workbooks.Open("C:\TPExcel\Representants.xls")
On Error Resume Next
iEnd = ThisWorkbook.Sheets("Feuil1").Range("D4").End(xlDo wn).Row
For Each c In ThisWorkbook.Sheets("Feuil1").Range("D4:D" & iEnd)
Numdpt = Left(c.Value, 2)
Colonne = ""
Colonne =
ClasseurRep.Sheets(1).Range("A4:F20").Find(What:=N umdpt, _
LookIn:=xlFormulas, LookAt:=xlWhole).Address
If Colonne < "" Then
Colonne = CInt(Range(Colonne).Column)
c.Offset(0, -1) = ClasseurRep.Sheets(1).Cells(3,
Colonne).Comment.Text
End If
Next c
ClasseurRep.Close
Set ClasseurRep = Nothing
End Sub


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie he I have a question about a print macro I am trying to write... Kyaba[_2_] Excel Programming 5 May 3rd 06 10:45 PM
Newbie questions - probably simple Sonnich Excel Programming 4 May 1st 06 08:42 PM
I want to write a book on my computer.How can I type? can353 New Users to Excel 4 March 17th 06 03:19 PM
How do I get a Template to write a Book ? peterm New Users to Excel 0 March 17th 05 02:39 AM
IF then write new worksheet/book Don Hansford[_2_] Excel Programming 0 April 2nd 04 04:24 PM


All times are GMT +1. The time now is 06:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"