Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default Compile error

Hello from Steved
I am getting
Compile error:
Expected Identifier

Sub
For x = 1 To 9
Cells(x, 1).Value = x & "-" & Cells(x, 1).Value
Next x
End Sub

Please help me I am trying my best to learn

Thankyou.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Compile error

Steve,

Worked when I gave the Sub a name, and declared the variable x
''''''''''''''''
Sub test()
Dim x As Long
For x = 1 To 9
Cells(x, 1).Value = x & "-" & Cells(x, 1).Value
Next x
End Sub
'''''''''''''''''''
hth
--

steveB

(Remove 'NOSPAM' from email address if contacting me direct)


"Steved" wrote in message
...
Hello from Steved
I am getting
Compile error:
Expected Identifier

Sub
For x = 1 To 9
Cells(x, 1).Value = x & "-" & Cells(x, 1).Value
Next x
End Sub

Please help me I am trying my best to learn

Thankyou.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default Compile error

Hello SteveB
Thankyou.

Now that it is working I would like to make a change,
as I have over 5000 rows.
Using your code would it be possible to customize it.
Col A , Col B, Col C the columns I use
Col A is only the column that requires the code to work in.

What I require it to do is as laid out below please.
Col A

City Change this to 1-City
Roskill Change this to 2-Rosk
Papakura Change this to 3-Papa
Wiri Change this to 4-Wiri
North Shore Change this to 5-Shor
Orewa Change this to 6-Orew
Swanson Change this to 7-Swan
Panmure Change this to 8-Panm
Waiheke Change this to 9-Waih

The issue is that any of the above could be anywhere in
Col A.

Thankyou.








-----Original Message-----
Steve,

Worked when I gave the Sub a name, and declared the

variable x
''''''''''''''''
Sub test()
Dim x As Long
For x = 1 To 9
Cells(x, 1).Value = x & "-" & Cells(x, 1).Value
Next x
End Sub
'''''''''''''''''''
hth
--

steveB

(Remove 'NOSPAM' from email address if contacting me

direct)


"Steved" wrote in

message
...
Hello from Steved
I am getting
Compile error:
Expected Identifier

Sub
For x = 1 To 9
Cells(x, 1).Value = x & "-" & Cells(x, 1).Value
Next x
End Sub

Please help me I am trying my best to learn

Thankyou.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default Compile error

I have reposted this, please refer to the new posting.

Thankyou.

-----Original Message-----
Hello SteveB
Thankyou.

Now that it is working I would like to make a change,
as I have over 5000 rows.
Using your code would it be possible to customize it.
Col A , Col B, Col C the columns I use
Col A is only the column that requires the code to work

in.

What I require it to do is as laid out below please.
Col A

City Change this to 1-City
Roskill Change this to 2-Rosk
Papakura Change this to 3-Papa
Wiri Change this to 4-Wiri
North Shore Change this to 5-Shor
Orewa Change this to 6-Orew
Swanson Change this to 7-Swan
Panmure Change this to 8-Panm
Waiheke Change this to 9-Waih

The issue is that any of the above could be anywhere in
Col A.

Thankyou.








-----Original Message-----
Steve,

Worked when I gave the Sub a name, and declared the

variable x
''''''''''''''''
Sub test()
Dim x As Long
For x = 1 To 9
Cells(x, 1).Value = x & "-" & Cells(x, 1).Value
Next x
End Sub
'''''''''''''''''''
hth
--

steveB

(Remove 'NOSPAM' from email address if contacting me

direct)


"Steved" wrote in

message
.. .
Hello from Steved
I am getting
Compile error:
Expected Identifier

Sub
For x = 1 To 9
Cells(x, 1).Value = x & "-" & Cells(x, 1).Value
Next x
End Sub

Please help me I am trying my best to learn

Thankyou.



.

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Compile error

Steved,

You need to give your subroutine a name -- that's the identifier the
compiler is looking for.

Sub MyRoutine()
....

By the way, you don't need the ".Value" on the right side of the equation.
This will work just as well, and may help you avoid problems in some
situations:

Cells(x, 1) = x & "-" & Cells(x, 1).Value

Good luck!

-- David



"Steved" wrote in message
...
Hello from Steved
I am getting
Compile error:
Expected Identifier

Sub
For x = 1 To 9
Cells(x, 1).Value = x & "-" & Cells(x, 1).Value
Next x
End Sub

Please help me I am trying my best to learn

Thankyou.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Solver - error - Compile Error Nina Excel Discussion (Misc queries) 0 August 19th 08 09:41 PM
help with this error-Compile error: cant find project or library JackR Excel Discussion (Misc queries) 2 June 10th 06 09:09 PM
How do I get rid of "Compile error in hidden module" error message David Excel Discussion (Misc queries) 4 January 21st 05 11:39 PM
Compile error in hidden module error Melissa Zebrowski Excel Programming 3 February 20th 04 01:29 PM


All times are GMT +1. The time now is 06:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"