View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Macro - IF command

Not tested at all but something along these lines:

Private Sub CommandButton4_Click()
Dim FileNames As Variant
Dim FileCount as Long
Dim DestWB As Workbook

Set DestWB = Application.Workbooks.Open("hawkmasterrep.xls") 'Add full
path

FileNames =GetOpenFileName(Multiselect=true)
If filenames<false then
For FileCount=0 to UBound(filenames)
With Workbooks.Open(Filenames(filecount), ReadOnly:=True)
.Sheets("Hide").Visible = True
.Sheets("Hide").Range("A4:BB4").Copy

DestWB.Sheets("Data").Range("A2").Offset(filecount ,
0).PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
.Close (False)
End With
FileCount=FileCount+1
loop
end if

NickHK

"okanem" wrote in
message ...

Nick, thanks for the reply, its not the white space I dislike, merely
the number of ' I have to delete if the code per order is multi line.

Can you elaborate on the Application.GetOpenFileName(Multiselect=True)
and show me how to incorporate it in my code.

Rgds
Okanem


--
okanem
------------------------------------------------------------------------
okanem's Profile:

http://www.excelforum.com/member.php...fo&userid=9301
View this thread: http://www.excelforum.com/showthread...hreadid=558216