Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I have made a program in vb 6 thats open excel and create a worksheet etc When a press my Command1 button . it works perfect, But when i close excel and press my button again i gott this error "Object variable or With block variable not set" so can someone help me ? This is this code it dosen't like ActiveCell.FormulaR1C1 = "=COUNTIF(RC[-2]:R[4]C[-2],RC[-1])" .Range("C2").Select Selection.AutoFill Destination:=.Range("C2:C5"), Type:=xlFillDefault CODE Private Sub Command1_Click() Dim objXL As Excel.Application Dim objWB As Excel.Workbook Dim objWS As Excel.Worksheet Set objXL = New Excel.Application Set objWB = objXL.Workbooks.Add Set objWS = objWB.Worksheets.Application.ActiveSheet With objWS .Cells(1, 1) = "HEJ" .Cells(2, 1) = "1" .Cells(3, 1) = "1" .Cells(4, 1) = "4" .Cells(5, 1) = "7" .Cells(6, 1) = "3" .Range("A1:A6").Select .Range("A1:A6").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=.Range("B1"), Unique:=True .Range("C2").Select ActiveCell.FormulaR1C1 = "=COUNTIF(RC[-2]:R[4]C[-2],RC[-1])" .Range("C2").Select Selection.AutoFill Destination:=.Range("C2:C5"), Type:=xlFillDefault End With objXL.Visible = True Set objXL = Nothing Set objWB = Nothing Set objWS = Nothing End Sub //Stelu |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Open 2000 file attachments in Excel 2000 | Excel Discussion (Misc queries) | |||
I cannot edit cell format in Excel 2000 (Part of office 2000)! | Excel Discussion (Misc queries) | |||
Using Excel 2000 as Data source for Word 2000 document | Excel Discussion (Misc queries) | |||
Hyperlink in Excel 2000 can't open bookmarked Word 2000 file | Excel Discussion (Misc queries) | |||
Excel Programs developed in Office 2000 on Windows 2000 | Excel Discussion (Misc queries) |