Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Stop a Procedure from another procedure | Excel Discussion (Misc queries) | |||
HOW TO CARRY A VAIABLE RESULTS FROM EXCEL SHEET PROCEDURE TO A MODULE | Excel Discussion (Misc queries) | |||
How to pass sheet reference to a procedure | Excel Programming | |||
two procedures in the same sheet one a workbook even procedure | Excel Programming |