I am new to QTP and VBScript, can anybody advise me of the error on this script at the line 'If myEmails = Nothing' which says 'object required'? Also any general feedback or improvement tips would be appreciated, I have spent way too long trying to get this script working now lol!
myEmails = ""
If emailSubjectToSearch = "[A-Za-z0-9_]" Then
Set myEmails = emails.Find("[Subject] = "& emailSubjectToSearch & "")
Else
If emailBodyToSearch = "[A-Za-z0-9_]" Then
Set myEmails = emails.Find("[Body] = "& emailBodyToSearch & "")
Else
If emailSenderNameToSearch = "[A-Za-z0-9_]" Then
Set myEmails = emails.Find("[SenderName] = "& emailSenderNameToSearch & "")
Else
If emailSentOnToSearch = "[A-Za-z0-9_]" Then
Set myEmails = emails.Find("[SentOn] = "& emailSentOnToSearch & "")
Else
If emailAttachmentToSearch = "[A-Za-z0-9_]" Then
Set myEmails = emails.Find("[Attachment] = "& emailAttachmentToSearch & "")
End If
End If
End If
End If
End If
If myEmails Is Nothing Then
MsgBox "Email not found"
Else
MsgBox "Email found"
msgbox myEmails
End If
Although I don't know about the entire script, but the following code snippet should work
myEmails = ""
If emailSubjectToSearch = "[A-Za-z0-9_]" Then
Set myEmails = emails.Find("[Subject] = "& emailSubjectToSearch & "")
ElseIf emailBodyToSearch = "[A-Za-z0-9_]" Then
Set myEmails = emails.Find("[Body] = "& emailBodyToSearch & "")
ElseIf emailSenderNameToSearch = "[A-Za-z0-9_]" Then
Set myEmails = emails.Find("[SenderName] = "& emailSenderNameToSearch & "")
ElseIf emailSentOnToSearch = "[A-Za-z0-9_]" Then
Set myEmails = emails.Find("[SentOn] = "& emailSentOnToSearch & "")
ElseIf emailAttachmentToSearch = "[A-Za-z0-9_]" Then
Set myEmails = emails.Find("[Attachment] = "& emailAttachmentToSearch & "")
End If
If IsNull(myEmails) Then
MsgBox "Email not found"
Else
MsgBox "Email found"
msgbox myEmails
End If
Testing on a null reference in VBScript is done by Is Nothing. The Is operator is comparable to === in other languages as Javascript.
Dim myObject ' uninitialized primitive with value empty (do not confuse with "" or 0)
Set myObject = new Regexp ' Now it has an object
Dim yourObject
Set yourObject = Nothing
If myObject Is Nothing then
MsgBox "MyObject is Nothing" ' won't be displayed
End if
If yourObject Is Nothing then
MsgBox "YourObject is Nothing" ' this is displayed
End if
Set yourObject = New RegExp
MsgBox (myObject Is yourObject) ' displays False
Set yourObject = myObject
MsgBox (myObject Is yourObject) ' displays True
Set myObject = Nothing
MsgBox "myObject: " & (myObject Is Nothing) & _
& ", yourObject: " & (yourObject Is Nothing)
' Displays myObject: True, yourObject: False
Use the
If Not (myObject Is Nothing) Then ...
construct to test if a variable contains a non-null object.
And use the
If IsObject(myObject) Then ...
construct to test if a variable contains a primitive or an object
Related
Private Sub LoginMasuk_Click()
Dim Password As String
Dim Level As String
Dim pass As String
pass = MD5(TextBox2.Value)
Set WsUserName = Sheets("Data")
Set RgUserPas = WsUserName.Range("A2:A20")
Set c = RgUserPas.Find(TextBox1.Value, LookIn:=xlValues, MatchCase:=False)
Password = c.Offset(0, 1).Value
Level = c.Offset(0, 2).Value
If pass <> Password Then
MsgBox "password yang anda masukan salah", vbCritical, "User Login"
Exit SubElse
If Level = "Admin" Then
MsgBox "Selamat Datang " & TextBox1.text, vbInformation, "Message"
'MsgBox "Anda Login Sebagai " & Level, vbInformation, "User Login"
loginApp.Hide
Sheets("Data").Visible = xlSheetVisible
Sheets("Hai").Visible = xlSheetVisible
Sheets("Halo").Visible = xlSheetVisible
Menu_Admin.Label1.Caption = Level
Menu_Admin.Show
Call bersih
Exit Sub
ElseIf Level = "Siswa" Then
MsgBox "Selamat Datang " & TextBox1.text, vbInformation, "Message"
'MsgBox "Anda Login Sebagai " & Level, vbInformation, "User Login"
loginApp.Hide
Sheets("Data").Visible = xlSheetVeryHidden
'Sheets("Data").Visible = xlSheetVisible
Sheets("Hai").Visible = xlSheetVisible
Sheets("Halo").Visible = xlSheetVisible
Menu_Siswa.Label1.Caption = Level
Menu_Siswa.Show
Call bersih
Exit Sub
End If
End If
End Sub
and I getting error in code -->
Password = c.Offset(0, 1).Value
how i solve it
Check to see if your .Find call actually found something first. Put this before that line:
If c Is Nothing Then
Msgbox "'" & TextBox1.Value & "' was not found"
Exit Sub
End If
I have code below for a print function created in VBA. When I select "Return from leave" under the drop down "Type of Change", my print macro prints as a "salary" change type, not "return from leave". I cant see where I went wrong in my code or what is causing the issue... Any thoughts? Thanks in advance!
Sub pcf_print()
Dim ws As Worksheet
Dim datasheet As Worksheet
Dim fs As Object
Dim str As String
Dim bool As Boolean
If Len(ActiveSheet.Name) < 3 Then
MsgBox "This worksheet is not a PCF"
Exit Sub
End If
If Left(ActiveSheet.Name, 3) <> "PCF" Then
MsgBox "This worksheet is not a PCF"
Exit Sub
End If
'MsgBox Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 1 - InStr(ActiveSheet.Name, " v")) 'Right(ActiveSheet.Name, 4)
If InStr(ActiveSheet.Name, " vv") Then
If (CDbl(Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 1 - InStr(ActiveSheet.Name, " vv") - 1)) >= 1.2 And (ActiveSheet.Range("F10") = "(select)" Or ActiveSheet.Range("F10") = "" Or ActiveSheet.Range("F10") = "(sélect.)")) Then
MsgBox "This form has not been completed"
Exit Sub
End If
Else
If (CDbl(Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 1 - InStr(ActiveSheet.Name, " v"))) < 1.2 And (ActiveSheet.Range("F9") = "(select)" Or ActiveSheet.Range("F9") = "")) Or (CDbl(Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 1 - InStr(ActiveSheet.Name, " v"))) >= 1.2 And (ActiveSheet.Range("F10") = "(select)" Or ActiveSheet.Range("F10") = "" Or ActiveSheet.Range("F10") = "(sélect.)")) Then
MsgBox "This form has not been completed"
Exit Sub
End If
End If
Set datasheet = ActiveSheet
If ActiveWorkbook.Worksheets("Form Lists").Range("CorpOrStore") = "Corp" Then
str = "Corporate"
Else
str = "Stores"
End If
Set fs = CreateObject("Scripting.FileSystemObject")
bool = fs.FolderExists("H:\HR\Online PCF Archive\" & str & "\" & Trim(datasheet.Range("StoreDeptResult")) & "\")
If Not bool Then
MkDir "H:\HR\Online PCF Archive\" & str & "\" & Trim(datasheet.Range("StoreDeptResult")) & "\"
End If
If InStr(ActiveSheet.Name, " vv") Then
If CDbl(Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 1 - InStr(ActiveSheet.Name, " vv") - 1)) >= 1.2 Then
ActiveWorkbook.SaveAs "H:\HR\Online PCF Archive\" & str & "\" & Trim(datasheet.Range("StoreDeptResult")) & "\" & Replace(datasheet.Range("F10"), "/", "_") & " for " & datasheet.Range("J17") & ", " & datasheet.Range("F17") & " effective " & Month(datasheet.Range("F12")) & "-" & Day(datasheet.Range("F12")) & "-" & Year(datasheet.Range("F12")) & ".xls"
End If
Else
If CDbl(Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 1 - InStr(ActiveSheet.Name, " v"))) >= 1.2 Then
ActiveWorkbook.SaveAs "H:\HR\Online PCF Archive\" & str & "\" & Trim(datasheet.Range("StoreDeptResult")) & "\" & Replace(datasheet.Range("F10"), "/", "_") & " for " & datasheet.Range("J17") & ", " & datasheet.Range("F17") & " effective " & Month(datasheet.Range("F12")) & "-" & Day(datasheet.Range("F12")) & "-" & Year(datasheet.Range("F12")) & ".xls"
Else
ActiveWorkbook.SaveAs "H:\HR\Online PCF Archive\" & str & "\" & Trim(datasheet.Range("StoreDeptResult")) & "\" & datasheet.Range("F9") & " for " & datasheet.Range("J16") & ", " & datasheet.Range("F16") & " effective " & Month(datasheet.Range("F11")) & "-" & Day(datasheet.Range("F11")) & "-" & Year(datasheet.Range("F11")) & ".xls"
End If
End If
Set ws = ActiveWorkbook.Worksheets("Payroll Forms")
If Right(ActiveSheet.Name, 5) = "v1.20" Then
ActiveWorkbook.Worksheets("Form Lists").Unprotect "0nl1n3"
ActiveWorkbook.Worksheets("Form Lists").Range("B8") = "A1:G76"
ActiveWorkbook.Worksheets("Form Lists").Range("B9") = "A80:G157"
ActiveWorkbook.Worksheets("Form Lists").Range("B10") = "A160:G225"
ActiveWorkbook.Worksheets("Form Lists").Range("B11") = "A228:G259"
ActiveWorkbook.Worksheets("Form Lists").Range("B12") = "A228:G259"
ActiveWorkbook.Worksheets("Form Lists").Range("B13") = "A228:G259"
ActiveWorkbook.Worksheets("Form Lists").Range("B14") = "A263:G338"
ActiveWorkbook.Worksheets("Form Lists").Range("B15") = "A263:G338"
ActiveWorkbook.Worksheets("Form Lists").Range("B16") = "A343:G367"
ActiveWorkbook.Worksheets("Form Lists").Range("B17") = "A263:G338"
ActiveWorkbook.Worksheets("Form Lists").Range("B18") = "A160:G225"
ActiveWorkbook.Worksheets("Form Lists").Range("B19") = "A370:G420"
ActiveWorkbook.Worksheets("Form Lists").Protect "0nl1n3"
End If
If Right(ActiveSheet.Name, 5) = "v1.20" Or Right(ActiveSheet.Name, 5) = "v1.21" Or str = "Corporate" Then
ws.PageSetup.PrintArea = ActiveWorkbook.Worksheets("Form Lists").Range("H2")
Else
ws.PageSetup.PrintArea = ActiveWorkbook.Worksheets("Form Lists").Range("i2")
End If
ActiveWorkbook.Unprotect "0nl1n3"
ws.Visible = xlSheetVisible
ws.PrintOut
ws.Visible = xlSheetHidden
ActiveWorkbook.Protect "0nl1n3"
ActiveWorkbook.Close False
End Sub
OP says:
When I select "Return from leave" under the drop down "Type of Change", my print macro prints as a "salary" change type, not "return from leave"
Assuming that the
"salary" change type
corresponds to the "default print" i.e.:
ws.PageSetup.PrintArea = ActiveWorkbook.Worksheets("Form Lists").Range("i2")
It seems that the reason the code provided always prints the default range, it's because the lines that determine the printed output are validating the ActiveSheet.Name instead of the value in the "Type of Change field and print"
Solution proposed:
Change these lines to reflect the cell where the "Type of Change field and print" is located:
Replace ActiveSheet.Name with the corresponding cell.address i.e.: F10 and update as required the comparisons against "v1.20" and "v1.21"
If Right(ActiveSheet.Name, 5) = "v1.20" _
Or Right(ActiveSheet.Name, 5) = "v1.21" _
Or str = "Corporate" Then
ws.PageSetup.PrintArea = ActiveWorkbook.Worksheets("Form Lists").Range("H2")
Else
ws.PageSetup.PrintArea = ActiveWorkbook.Worksheets("Form Lists").Range("i2")
End If
It should become (comparison values shown as a reference, they should be updated in line with the choices in the drop-down list) :
If ActiveSheet.Range("F10").Value2 = "Return from leave" _
Or str = "Corporate" Then
ws.PageSetup.PrintArea = ActiveWorkbook.Worksheets("Form Lists").Range("H2")
Else
ws.PageSetup.PrintArea = ActiveWorkbook.Worksheets("Form Lists").Range("i2")
End If
Note:
1. Avoid using ActiveWorkbook and ActiveSheet, suggest to replace all instances of them by: ThisWorkbook and datasheet respectively.
2. Additionally, I would suggest to review and incorporate the use of With statement and Select Case statement throughout your procedure.
I am using a macro that pulls employee names from an active directory using a department number. I need to be able to display each employee found into a cell range, preferably Range("A1:A10"). My current macro is listing all the results into Range("B3"). Any help with this would be appreciated. I've broken down my code in two parts. 1st part gets called when employee clicks on a button from a userform, second part is a function that connects to active directory:
Sub is linked to a Command Button on a userform
Sub opsldap()
Dim ws As Worksheet
Set ws = Sheets("Sheet1")
struser = opslogin.TextBox1
struserdn = Get_LDAP_User_Properties("user", "department", struser, "displayName")
If Len(struserdn) <> 0 Then
ws.Range("B3").Value = struserdn
MsgBox "Welcome to Op's Vision " & struserdn
Else
MsgBox "Cant Find"
End If
End Sub
Function to get results from Active Directory
Function Get_LDAP_User_Properties(strObjectType, strSearchField, strObjectToGet, strCommaDelimProps)
On Error GoTo EarlyExit
If InStr(strObjectToGet, "\") > 0 Then
arrGroupBits = Split(strObjectToGet, "\")
strDC = arrGroupBits(0)
strDNSDomain = strDC & "/" & "DC=" & Replace(Mid(strDC, InStr(strDC, ".") + 1), ".", ",DC=")
strObjectToGet = arrGroupBits(1)
Else
' Otherwise we just connect to the default domain
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("defaultNamingContext")
End If
strBase = "<LDAP://" & strDNSDomain & ">"
' Setup ADO objects.
Set adoCommand = CreateObject("ADODB.Command")
Set ADOConnection = CreateObject("ADODB.Connection")
ADOConnection.Provider = "ADsDSOObject"
ADOConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = ADOConnection
' Filter on user objects.
'strFilter = "(&(objectCategory=person)(objectClass=user))"
strFilter = "(&(objectClass=" & strObjectType & ")(" & strSearchField & "=" & strObjectToGet & "))"
' Comma delimited list of attribute values to retrieve.
strAttributes = strCommaDelimProps
arrProperties = Split(strCommaDelimProps, ",")
' Construct the LDAP syntax query.
strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
' Define the maximum records to return
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False
' Run the query.
Set adoRecordset = adoCommand.Execute
' Enumerate the resulting recordset.
strReturnVal = ""
Do Until adoRecordset.EOF
' Retrieve values and display.
For intCount = LBound(arrProperties) To UBound(arrProperties)
If strReturnVal = "" Then
strReturnVal = adoRecordset.Fields(intCount).Value
Else
strReturnVal = strReturnVal & vbCrLf & adoRecordset.Fields(intCount).Value
End If
Next
' Move to the next record in the recordset.
adoRecordset.MoveNext
Loop
' Clean up.
adoRecordset.Close
ADOConnection.Close
Get_LDAP_User_Properties = strReturnVal
EarlyExit:
On Error GoTo 0
End Function
Here is the split array I am using:
Sub opsldap()
Dim textstring As String, Warray() As String, counter As Integer, strg As String
struser = opslogin.TextBox1
struserdn = Get_LDAP_User_Properties("user", "department", struser, "displayName")
If Len(struserdn) <> 0 Then
textstring = struserdn
Warray() = split(textstring, vbNewLine)
For counter = LBound(Warray) To UBound(Warray)
strg = Warray(counter)
Cells(counter + 3, 1).Value = Trim(strg)
Next counter
Else
MsgBox "I couldnt locate that cost center"
End If
End Sub
I'm new to VBA and need get some help with a VLOOKUP?
I keep getting Compile error for Expected: end of statement
This is the line that is giving me problems.
I added the & sign after (row_number) and am now getting a run-time error '9': Subscript out of range error.
Sheets("WIP Count").Range("G" & (row_number)).Formula = "=VLOOKUP(C" & (row_number) & ",PRISM!L:T,8,FALSE)"
Here is the rest of the code.
Sub CommandButton1_Click()
q1_answer = Sheets("Tracker").Range("F8")
q2_answer = Sheets("Tracker").Range("F9")
q3_answer = Sheets("Tracker").Range("F10")
q4_answer = Sheets("Tracker").Range("F11")
If q1_answer = "" Then
MsgBox "Fill in Name"
Exit Sub
End If
If q2_answer = "" Then
MsgBox "Fill in Serial Number"
Exit Sub
End If
If q3_answer = "" Then
MsgBox "Fill in Part Number"
Exit Sub
End If
If q4_answer = "" Then
MsgBox "Fill in Quantity"
Exit Sub
End If
row_number = 1
Do
DoEvents
row_number = row_number + 1
item_in_review = Sheets("WIP_Count").Range("A" & row_number)
Loop Until item_in_review = ""
last_transaction_id = Sheets("WIP_Count").Range("A" & (row_number - 1))
Dim next_transaction_id As Integer
next_transaction_id = last_transaction_id + 1
Sheets("WIP_Count").Range("A" & (row_number)) = next_transaction_id
Sheets("WIP_Count").Range("B" & (row_number)) = q1_answer
Sheets("WIP_Count").Range("C" & (row_number)) = q2_answer
Sheets("WIP_Count").Range("D" & (row_number)) = q3_answer
Sheets("WIP_Count").Range("E" & (row_number)) = q4_answer
Sheets("WIP_Count").Range("F" & (row_number)).Value = Date
Sheets("WIP Count").Range("G" & (row_number)).Formula = "=VLOOKUP(C" & (row_number) & ",PRISM!L:T,8,FALSE)"
Sheets("Tracker").Range("F8") = ""
Sheets("Tracker").Range("F9") = ""
Sheets("Tracker").Range("F10") = ""
Sheets("Tracker").Range("F11") = ""
MsgBox "Done"
End Sub
I have a project I am working on where my team uses an excel front end to manipulate the data which in turn updates an access database back-end to hold the database. (there are good reasons for this)
The current version works by if a user changes data in a cell and wants to update the database they highlight the cell(s) and hit an update button. (this becomes annoying doing multiple updates). So I started playing with the worksheet_changed function.
In order for the worksheet_changed function to work the user has to move off of the 'updated' cell in order for excel to notice the change and update the code. (In my case hitting enter or down arrow after data entry). I have gotten this to work well using the offset property to look at the row above and enter that line into the database - however - when the spreadsheet is filtered as it always is...if the row above happens to be hidden it will update that row when actually I need the visible cell to update....so I am stuck - below is a small chunk of the code used to update the database.
Private Sub Worksheet_Change(ByVal Target As Range)
Refreshbuttons
Dim KeyCells As Range
Dim aCell As Range
Const TARGET_DB = "MKT DB1.accdb"
Dim VErrors(4) As String
VErrors(0) = "Y"
VErrors(1) = "YES"
VErrors(2) = "1"
VErrors(3) = "TRUE"
Dim NVErrors(5) As String
NVErrors(0) = "N"
NVErrors(1) = "NO"
NVErrors(2) = ""
NVErrors(3) = "0"
NVErrors(4) = "FALSE"
Set srch = Range("A4:Z4").Find("PROJECTID", , xlValues, xlWhole)
PRO = Chr(srch.Column + 64)
Set srch = Range("A4:Z4").Find("PROJECTDES", , xlValues, xlWhole)
PD = Chr(srch.Column + 64)
Set srch = Range("A4:Z4").Find("ECAT", , xlValues, xlWhole)
EC = Chr(srch.Column + 64)
Set srch = Range("A4:Z4").Find("SALEMODEL", , xlValues, xlWhole)
SM = Chr(srch.Column + 64)
Set srch = Range("A4:Z4").Find("MKDBROSOURCE", , xlValues, xlWhole)
MDR = Chr(srch.Column + 64)
Set srch = Range("A4:Z4").Find("SOLREVIEWED", , xlValues, xlWhole)
SRD = Chr(srch.Column + 64)
Set srch = Range("A4:Z4").Find("DBSUPPORTEDDUEDATE", , xlValues, xlWhole)
DSDD = Chr(srch.Column + 64)
Set srch = Range("A4:Z4").Find("CATEGORY", , xlValues, xlWhole)
CT = Chr(srch.Column + 64)
Set srch = Range("A4:Z4").Find("COMPLETE", , xlValues, xlWhole)
CMP = Chr(srch.Column + 64)
Set srch = Range("A4:Z4").Find("STYLECOUNT", , xlValues, xlWhole)
SC = Chr(srch.Column + 64)
Set srch = Range("A4:Z4").Find("ECATREADY", , xlValues, xlWhole)
ECR = Chr(srch.Column + 64)
Set srch = Range("A4:Z4").Find("ESTHRS", , xlValues, xlWhole)
EST = Chr(srch.Column + 64)
Set srch = Range("A4:Z4").Find("ACTUALHRS", , xlValues, xlWhole)
AH = Chr(srch.Column + 64)
Set cnn = New ADODB.Connection
MyConn = ThisWorkbook.Path & Application.PathSeparator & TARGET_DB
With cnn
.Provider = "Microsoft.ACE.OLEDB.12.0"
.Open MyConn
End With
projectCount = 0
**For Each C In Selection.Offset(-1,0).Rows
tmp = C.Address** // THIS IS WHERE MY ISSUE IS - IT LOOKS TO THE ROW ABOVE AND NOT THE VISIBLE ROW
ChangeFields = ""
ChangeValuesOld = ""
ChangeValuesNew = ""
If Range("A" & C.Row).EntireRow.Hidden = False Then
'create the recordset
Set rst = New ADODB.Recordset
rst.CursorLocation = adUseServer
'On Error GoTo Err1:
strSQL = "SELECT * FROM Projects WHERE Projectid = " & Range(PRO & C.Row).Value & ""
rst.Open Source:=strSQL, _
ActiveConnection:=cnn
If rst.EOF = False Then
'Start = GetTickCount()
If rst("Projectid") <> Range(PRO & C.Row).Value Or (IsNull(rst("Projectid")) And Range(PRO & C.Row).Value <> "") Then
If IsNull(rst("projectid")) Then
ChangeValuesOld = ChangeValuesOld & "NULL "
Else
ChangeValuesOld = ChangeValuesOld & rst("projectid") & " "
End If
If IsEmpty(Range(PRO & C.Row).Value) Then
ChangeValuesNew = ChangeValuesNew & "NULL "
Else
ChangeValuesNew = ChangeValuesNew & Range(PRO & C.Row).Value & " "
End If
ChangeFields = ChangeFields & "PROJECTID "
End If
If rst("ProjectDes") <> Range(PD & C.Row).Value Or (IsNull(rst("ProjectDes")) And Range(PD & C.Row).Value <> "") Then
If IsNull(rst("ProjectDes")) Then
ChangeValuesOld = ChangeValuesOld & "NULL "
Else
ChangeValuesOld = ChangeValuesOld & rst("ProjectDes") & " "
End If
If IsEmpty(Range(PD & C.Row).Value) Then
ChangeValuesNew = ChangeValuesNew & "NULL "
Else
ChangeValuesNew = ChangeValuesNew & Range(PD & C.Row).Value & " "
End If
ChangeFields = ChangeFields & "ProjectDes "
End If
If rst("ECAT") <> Range(EC & C.Row).Value Or (IsNull(rst("ECAT")) And Range(EC & C.Row).Value <> "") Then
If IsNull(rst("ECAT")) Then
ChangeValuesOld = ChangeValuesOld & "NULL "
Else
ChangeValuesOld = ChangeValuesOld & rst("ECAT") & " "
End If
If IsEmpty(Range(EC & C.Row).Value) Then
ChangeValuesNew = ChangeValuesNew & "NULL "
Else
ChangeValuesNew = ChangeValuesNew & Range(EC & C.Row).Value & " "
End If
ChangeFields = ChangeFields & "ECAT "
Any help is GREATLY appreciated - thank you
Target.address
this should reference the cell address of the changed cell, so unless you change a hidden cell a hidden cell should not be referenced
if you just need the row you should be able to do Target.Row