How do ressolve this auto-sorting macro issue?

How do ressolve this auto-sorting macro issue?

Hi, I posted the below in a thread yesterday, and was amazed how quick you got back to me:

Hi,

I am having a bit of trouble on this same issue.

in my spreadsheet columns A-C are sorted in desending order based on the value of Column A. I would like the sheet to re-sort when the values in column A change. Im not sure if its important or not but when the value in column A changes then column B changes accordingly.

i Pasted the code from above and modified it:

REM sheet module
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = false
On Error Goto ENEV
REM add your code below
'Msgbox "Target.Address:" & Target.Address '
if (Target.Address = "$A$1:$C$100") then 'Replace the total rage of webdata
Target.Sort Key1:=Range("A3:A100"),Order1:=xlDescending,Header:=xlNo,MatchCase:=true,Orientation:=xlTopToBottom
'Replace the range which is used to sort in the key1
end if
ENEV:
Application.EnableEvents = true


and i get the following error message:

Encountered "<EOF>" at line 20, column 1.Was expecting one of:
<ENDSUB>,  <IDENTIFIER>,  <DOT>,  "SET",  "LET",  "CALL",  "IF",  "DIM",  "REDIM",  "FOR",  "DO",  "WHILE",  "CONST",  "STATIC",  <SELECTCASE>,  "WITH",  <EXITFUNCTION>,  <EXITSUB>,  <EXITDO>,  <EXITFOR>,  "END",  <ONERROR>,  "GOTO",  <REMARK>,  "<%%>",  "<%=%>",  <NL>,  ":", 

This is a different language to any i know and im well and truely lost!
Any help would be amazing.

dan


Abinaya got back to me and told me that id missed the end sub line so i put that in and edited my table, the new macro i have been trying to enter reads like this:

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = false
On Error Goto ENEV
REM add your code below
'Msgbox "Target.Address:" & Target.Address '
if (Target.Address = "$A$1:$C$100") then 'Replace the total rage of webdata
Target.Sort Key1:=Range("A3:A100"),Order1:=xlDescending,Header:=xlYes,MatchCase:=true,Orientation:=xlTopToBottom
'Replace the range which is used to sort in the key1
end if
ENEV:
Application.EnableEvents = true
End Sub

I enter this in the VBA editor (in the macro modules and sheet 1 sections) and it still does not work, and furthermore, if i click run macro i get the message 'no macros found'

Any help would be greatly apprieciated.

Dan























































      • Sticky Posts

      • Deprecation of certain URL patterns for published Zoho Writer documents

        Hi Zoho Writer users! We'd like to let you know that we have deprecated certain URL patterns for published and embedded documents in Zoho Writer due to security reasons. If the published or embedded documents are in any of these URL patterns, then their
      • [Announcement] Insert image from URL changes in Zoho Writer

        Hi Zoho Writer users! We'd like to let you know that we've changed the behavior of the Insert image from URL option in Zoho Writer for security reasons. Earlier behavior Once you inserted an image URL in a Writer document, the image would be fetched from
      • Introducing plagiarism checker in Zoho Writer

        Zia, Zoho Writer's AI-driven writing assistant, now highlights plagiarized and duplicated content in addition to offering contextual grammar and writing suggestions to help you write clearly and concisely in English. Zoho Writer's plagiarism reports Here
      • [Important announcement] Impact of Google's new email guidelines for Zoho Writer automation users

        Hi users, Google has recently announced new guidelines for sending emails to Gmail and other Google-hosted domains. These guidelines will be effective starting Feb. 1, 2024, and can impact the delivery of emails sent from Zoho Writer. Your organization
      • Transitioning from MS Word to Writer: A complete walkthrough

        Hello everyone! We understand moving to a new word processing tool can be difficult, especially if it means switching from a legacy software like MS Word. That's why we've organized an exclusive webinar where we talk you through ways to make your switch from MS Word to Writer as easy as possible. In this webinar, you'll learn: - Why Writer is a simple yet powerful alternative to MS Word. - How to locate your favorite MS Word features and functions in Writer.  - How to migrate your Word documents