I have a problem.
The error in subject appear when i run the macro
Can u tell me why -
-
Case "CENTRALIZATOR SURVEY"
-
Dim SHT As Object
-
Set SHT = Application.ThisWorkbook.Sheets("CENTRALIZATOR SURVEY")
-
SHT.Cells(10, 1) = UCase(n)
-
If IsEmpty(SHT.Cells(11, 1)) = False Then
-
Do
-
Range(SHT.Cells(11, 1), Cells(11, 8)).Select
-
Selection.EntireRow.Delete
-
Set SHT = Nothing
-
Loop Until IsEmpty(SHT.Cells(11, 1))
-
End If
-
nr_crt = 0
-
suma = 0
-
For i = 5 To 184
-
For j = 3 To 6
-
Select Case ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j).Value
-
Case "SURVEY S1"
-
Set SHT = Application.ThisWorkbook.Sheets("CENTRALIZATOR SURVEY")
-
nr_crt = nr_crt + 1
-
suma = suma + 5
-
For k = 10 To 10 + nr_crt
-
If ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(1, 3).Value = ThisWorkbook.Sheets("CENTRALIZATOR SURVEY").Cells(k, 1).Value Then
-
Range(SHT.Cells(k + nr_crt, 1), Cells(k + nr_crt, 8)).Select
-
Selection.EntireRow.Copy
-
Selection.Insert
-
Application.CutCopyMode = False
-
SHT.Cells(k + nr_crt, 1).Value = nr_crt
-
SHT.Cells(k + nr_crt, 2).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 1).Value
-
SHT.Cells(k + nr_crt, 3).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 2).Value
-
SHT.Cells(k + nr_crt, 4).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 3).Value
-
SHT.Cells(k + nr_crt, 5).Value = "S1"
-
End If
-
-
Next k
-
Set SHT = Nothing
-
Case "SURVEY S2"
-
Set SHT = Application.ThisWorkbook.Sheets("CENTRALIZATOR SURVEY")
-
nr_crt = nr_crt + 1
-
suma = suma + 40
-
For k = 10 To 10 + nr_crt
-
If ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(1, 3).Value = SHT.Cells(k, 1).Value Then
-
Range(SHT.Cells(k + nr_crt, 1), Cells(k + nr_crt, 8)).Select
-
Selection.EntireRow.Copy
-
Selection.Insert
-
Application.CutCopyMode = False
-
SHT.Cells(k + nr_crt, 1).Value = nr_crt
-
SHT.Cells(k + nr_crt, 2).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 1).Value
-
SHT.Cells(k + nr_crt, 3).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 2).Value
-
SHT.Cells(k + nr_crt, 4).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 3).Value
-
SHT.Cells(k + nr_crt, 5).Value = "S2"
-
End If
-
-
Next k
-
Set SHT = Nothing
-
Case "ALTE SERVICII"
-
Set SHT = Application.ThisWorkbook.Sheets("CENTRALIZATOR SURVEY")
-
nr_crt = nr_crt + 1
-
suma = suma + 10
-
For k = 10 To 10 + nr_crt
-
If ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(1, 3).Value = SHT.Cells(k, 1).Value Then
-
Range(SHT.Cells(k + nr_crt, 1), Cells(k + nr_crt, 8)).Select
-
Selection.EntireRow.Copy
-
Selection.Insert
-
Application.CutCopyMode = False
-
SHT.Cells(k + nr_crt, 1).Value = nr_crt
-
SHT.Cells(k + nr_crt, 2).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 1).Value
-
SHT.Cells(k + nr_crt, 3).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 2).Value
-
SHT.Cells(k + nr_crt, 4).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 3).Value
-
SHT.Cells(k + nr_crt, 5).Value = "A"
-
End If
-
-
Next k
-
Set SHT = Nothing
-
Case "RECUPERARE"
-
Set SHT = Application.ThisWorkbook.Sheets("CENTRALIZATOR SURVEY")
-
nr_crt = nr_crt + 1
-
suma = suma + 20
-
For k = 10 To 10 + nr_crt
-
If ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(1, 3).Value = SHT.Cells(k, 1).Value Then
-
Range(SHT.Cells(k + nr_crt, 1), Cells(k + nr_crt, 8)).Select
-
Selection.EntireRow.Copy
-
Selection.Insert
-
Application.CutCopyMode = False
-
SHT.Cells(k + nr_crt, 1).Value = nr_crt
-
SHT.Cells(k + nr_crt, 2).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 1).Value
-
SHT.Cells(k + nr_crt, 3).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 2).Value
-
SHT.Cells(k + nr_crt, 4).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 3).Value
-
SHT.Cells(k + nr_crt, 5).Value = "D"
-
-
End If
-
-
Next k
-
Set SHT = Nothing
-
End Select
-
Set SHT = Application.ThisWorkbook.Sheets("CENTRALIZATOR SURVEY")
-
SHT.Cells(nr_crt + 13, 6).Value = suma
-
Set SHT = Nothing
-
Next j
-
Next i
-
4 7125
I have a problem.
The error in subject appear when i run the macro
Can u tell me why - Case "CENTRALIZATOR SURVEY"
-
Dim SHT As Object
-
Set SHT = Application.ThisWorkbook.Sheets("CENTRALIZATOR SURVEY")
-
SHT.Cells(10, 1) = UCase(n)
-
If IsEmpty(SHT.Cells(11, 1)) = False Then
-
Do
-
Range(SHT.Cells(11, 1), Cells(11, 8)).Select
-
Selection.EntireRow.Delete
-
Set SHT = Nothing
-
Loop Until IsEmpty(SHT.Cells(11, 1))
-
End If
-
nr_crt = 0
-
suma = 0
-
For i = 5 To 184
-
For j = 3 To 6
-
Select Case ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j).Value
-
Case "SURVEY S1"
-
Set SHT = Application.ThisWorkbook.Sheets("CENTRALIZATOR SURVEY")
-
nr_crt = nr_crt + 1
-
suma = suma + 5
-
For k = 10 To 10 + nr_crt
-
If ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(1, 3).Value = ThisWorkbook.Sheets("CENTRALIZATOR SURVEY").Cells(k, 1).Value Then
-
Range(SHT.Cells(k + nr_crt, 1), Cells(k + nr_crt, 8)).Select
-
Selection.EntireRow.Copy
-
Selection.Insert
-
Application.CutCopyMode = False
-
SHT.Cells(k + nr_crt, 1).Value = nr_crt
-
SHT.Cells(k + nr_crt, 2).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 1).Value
-
SHT.Cells(k + nr_crt, 3).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 2).Value
-
SHT.Cells(k + nr_crt, 4).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 3).Value
-
SHT.Cells(k + nr_crt, 5).Value = "S1"
-
End If
-
Next k
-
Set SHT = Nothing
-
Case "SURVEY S2"
-
Set SHT = Application.ThisWorkbook.Sheets("CENTRALIZATOR SURVEY")
-
nr_crt = nr_crt + 1
-
suma = suma + 40
-
For k = 10 To 10 + nr_crt
-
If ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(1, 3).Value = SHT.Cells(k, 1).Value Then
-
Range(SHT.Cells(k + nr_crt, 1), Cells(k + nr_crt, 8)).Select
-
Selection.EntireRow.Copy
-
Selection.Insert
-
Application.CutCopyMode = False
-
SHT.Cells(k + nr_crt, 1).Value = nr_crt
-
SHT.Cells(k + nr_crt, 2).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 1).Value
-
SHT.Cells(k + nr_crt, 3).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 2).Value
-
SHT.Cells(k + nr_crt, 4).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 3).Value
-
SHT.Cells(k + nr_crt, 5).Value = "S2"
-
End If
-
Next k
-
Set SHT = Nothing
-
Case "ALTE SERVICII"
-
Set SHT = Application.ThisWorkbook.Sheets("CENTRALIZATOR SURVEY")
-
nr_crt = nr_crt + 1
-
suma = suma + 10
-
For k = 10 To 10 + nr_crt
-
If ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(1, 3).Value = SHT.Cells(k, 1).Value Then
-
Range(SHT.Cells(k + nr_crt, 1), Cells(k + nr_crt, 8)).Select
-
Selection.EntireRow.Copy
-
Selection.Insert
-
Application.CutCopyMode = False
-
SHT.Cells(k + nr_crt, 1).Value = nr_crt
-
SHT.Cells(k + nr_crt, 2).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 1).Value
-
SHT.Cells(k + nr_crt, 3).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 2).Value
-
SHT.Cells(k + nr_crt, 4).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 3).Value
-
SHT.Cells(k + nr_crt, 5).Value = "A"
-
End If
-
Next k
-
Set SHT = Nothing
-
Case "RECUPERARE"
-
Set SHT = Application.ThisWorkbook.Sheets("CENTRALIZATOR SURVEY")
-
nr_crt = nr_crt + 1
-
suma = suma + 20
-
For k = 10 To 10 + nr_crt
-
If ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(1, 3).Value = SHT.Cells(k, 1).Value Then
-
Range(SHT.Cells(k + nr_crt, 1), Cells(k + nr_crt, 8)).Select
-
Selection.EntireRow.Copy
-
Selection.Insert
-
Application.CutCopyMode = False
-
SHT.Cells(k + nr_crt, 1).Value = nr_crt
-
SHT.Cells(k + nr_crt, 2).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 1).Value
-
SHT.Cells(k + nr_crt, 3).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 2).Value
-
SHT.Cells(k + nr_crt, 4).Value = ThisWorkbook.Sheets("RAPORT ZILNIC").Cells(i, j + 3).Value
-
SHT.Cells(k + nr_crt, 5).Value = "D"
-
End If
-
Next k
-
Set SHT = Nothing
-
End Select
-
Set SHT = Application.ThisWorkbook.Sheets("CENTRALIZATOR SURVEY")
-
SHT.Cells(nr_crt + 13, 6).Value = suma
-
Set SHT = Nothing
-
Next j
-
Next i
Hi.
I've put [c o d e] tags around your code, as it aids readability. I also reduced thge indenting a bit, just to reduce sideways scrolling a little here on TheScripts. Sorry about that.
Could you please give us a hint as to where in this code the error occurs?
Also, where is the code located? If it's in a module rather than a worksheet, perhaps it doesn't know what to apply the Range method to.
the error appear in first range at case "centralizator survey" and the same in case "centralizator instalari"
and YES is in a module
Maybe you need to refer to CurrentSheet.Range or something? How is the Range function supposed to know what object sheet you're referring to?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: James |
last post by:
Hi,
I would like to run a custom script on a linux box via a button on a php
page (php webpage hosted on the same linux box).
Is this possible? If so , can you give me a pointer in the right...
|
by: leroybt.rm |
last post by:
Can someone tell me how to run a script from a interactive shell
I type the following:
>>>python filename
>>>python filename.py
>>>run filename
>>>run filename.py
>>>/run filename
>>>/run...
|
by: Ed |
last post by:
Hello,
I took a course in asp about 2 years ago and I was
practicing with IIS 5.0. Then I put it down for a while.
Now trying to get back to it. I can't run asp files from
subdirectories of...
|
by: orekin |
last post by:
Hi There
I have been trying to come to grips with Application.Run(),
Application.Exit() and the Message Pump and I would really appreciate
some feedback on the following questions .. There are...
|
by: shank |
last post by:
What is the proper syntax to run this command line in ASP?
wzzip.exe File.zip File.txt
thanks
|
by: David Thielen |
last post by:
Hi;
In our setup program how do I determine if I need to run "aspnet_regiis –i"
and if so, is there an API I can calll rather than finding that program on
the user's disk and calling it?
--...
|
by: Chief |
last post by:
Hello i would like to know
which syntax do i have to use in order to make a program run other
*.exe program and also how to put inputs in it
for example i want to to make a program that run...
|
by: traceable1 |
last post by:
Is there a way I can set up a SQL script to run when the instance
starts up?
SQL Server 2005 SP2
thanks!
|
by: Sean DiZazzo |
last post by:
Is there something special you have to do to get a wxPython app to run
remotely under xwindows? My Tkinter apps always automatically work
that way, so I was surprised to even be confronted with...
|
by: maya |
last post by:
hi,
this is very annoying.. this is on IE7/Vista.. whenever I load a pg
with JavaScript on it IE refuses to run the JavaScript (I'm talking
about JavaScript written BY ME....;) and the weird...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |