Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default take sheet to procedure

I know where I made mistake. I wanted to create procedure in loop it look
like this(names are in polish and I use example names:))

Dim i As Integer

Sub do_samething(use_file As Worksheet)

If use_file.Cells(i, "A") 0 Then

use_file.Cells(i, "G") = "samething"

End If

End Sub

Private Sub CommandButton1_Click()
i = 1

'file_one is file with button with this macro

Dim file_two As Workbook
Dim sheet_two As Worksheet 'sheet in file_two

Set file_two = Workbooks("file to use.xls")
Set sheet_two = file_two.Sheets("some_kind_sheet")

Do While file_one.sheet_one.Cells(i, "A") < Empty

do_samething (file_two)

i = i + 1
Loop

End Sub

and you see now that in while I'm checking one thing and inside loop I'm
using seckend file. I think this is problem but I'm not sure.



" wrote:

I want to take sheet to procedure and i don't know how write it
I thought I must do this like that:

sub procedure1(sheet1 as worksheet)
...
end sub

sub main()

Dim file As Workbook
Dim sheet2 As Worksheet

Set file = Workbooks("file to use.xls")
Set sheet2= file.Sheets("somekindsheet")

procedure1 sheet2 ''I tried too procedure1(sheet2) and didn't work

end sub

and I don't know what I'm doing wrong. When I create procedure for value
everything is ok and working but for worksheet...

Reply
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
Stop a Procedure from another procedure Ayo Excel Discussion (Misc queries) 1 October 30th 08 01:42 AM
HOW TO CARRY A VAIABLE RESULTS FROM EXCEL SHEET PROCEDURE TO A MODULE CAPTGNVR Excel Discussion (Misc queries) 5 February 2nd 07 07:05 PM
How to pass sheet reference to a procedure djd Excel Programming 1 September 23rd 05 04:17 PM
two procedures in the same sheet one a workbook even procedure R.VENKATARAMAN Excel Programming 2 September 8th 04 10:46 AM


All times are GMT +1. The time now is 04:17 AM.

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"