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

Good Morning all - (well it was a good morning until i got out of bed!)

I have been using a workbook for months without any problems and this
morning....not working.

The only piece of code that i have changed is changing the background of a
commandbutton when it is pressed.

The code is:

Private Sub CommandButton3_Click()
CommandButton3.BackColor = vbRed
CommandButton1.BackColor = vbRed
Call clear_old_locates
End Sub

Private Sub clear_old_locates()
Sheets("MS").Select
Columns("E:I").Select
Selection.ClearContents
End Sub

When it reaches the "Columns("E:I").Select" i get an error.

"Run-time error '1004';
Application-defined or object-defined error"

I have tried changing the way i select the column using ranges, etc but
still get thrown out errors...

Any ideas?!

Thx


Richard


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Selecting columns



--
__________________________________
HTH

Bob

"Richard Edwards" wrote in message
...
Good Morning all - (well it was a good morning until i got out of bed!)

I have been using a workbook for months without any problems and this
morning....not working.

The only piece of code that i have changed is changing the background of a
commandbutton when it is pressed.

The code is:

Private Sub CommandButton3_Click()
CommandButton3.BackColor = vbRed
CommandButton1.BackColor = vbRed
Call clear_old_locates
End Sub

Private Sub clear_old_locates()
Sheets("MS").Select
Columns("E:I").Select
Selection.ClearContents
End Sub

When it reaches the "Columns("E:I").Select" i get an error.

"Run-time error '1004';
Application-defined or object-defined error"

I have tried changing the way i select the column using ranges, etc but
still get thrown out errors...

Any ideas?!

Thx


Richard



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,420
Default Selecting columns

Me too, but this works


Private Sub clear_old_locates()
Sheets("MS").Columns("E:I").ClearContents
End Sub

--
__________________________________
HTH

Bob

"Richard Edwards" wrote in message
...
Good Morning all - (well it was a good morning until i got out of bed!)

I have been using a workbook for months without any problems and this
morning....not working.

The only piece of code that i have changed is changing the background of a
commandbutton when it is pressed.

The code is:

Private Sub CommandButton3_Click()
CommandButton3.BackColor = vbRed
CommandButton1.BackColor = vbRed
Call clear_old_locates
End Sub

Private Sub clear_old_locates()
Sheets("MS").Select
Columns("E:I").Select
Selection.ClearContents
End Sub

When it reaches the "Columns("E:I").Select" i get an error.

"Run-time error '1004';
Application-defined or object-defined error"

I have tried changing the way i select the column using ranges, etc but
still get thrown out errors...

Any ideas?!

Thx


Richard



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Selecting columns

fantastic. thanks very much.

how odd - as i say it had been working for months...

have a good day.

rich

"Bob Phillips" wrote in message
...
Me too, but this works


Private Sub clear_old_locates()
Sheets("MS").Columns("E:I").ClearContents
End Sub

--
__________________________________
HTH

Bob

"Richard Edwards" wrote in message
...
Good Morning all - (well it was a good morning until i got out of bed!)

I have been using a workbook for months without any problems and this
morning....not working.

The only piece of code that i have changed is changing the background of
a commandbutton when it is pressed.

The code is:

Private Sub CommandButton3_Click()
CommandButton3.BackColor = vbRed
CommandButton1.BackColor = vbRed
Call clear_old_locates
End Sub

Private Sub clear_old_locates()
Sheets("MS").Select
Columns("E:I").Select
Selection.ClearContents
End Sub

When it reaches the "Columns("E:I").Select" i get an error.

"Run-time error '1004';
Application-defined or object-defined error"

I have tried changing the way i select the column using ranges, etc but
still get thrown out errors...

Any ideas?!

Thx


Richard





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
Selecting Columns [email protected][_2_] Excel Programming 2 February 25th 09 11:38 AM
Selecting Columns [email protected][_2_] Excel Programming 1 February 24th 09 11:31 PM
Selecting Columns Shatin[_2_] Excel Programming 4 September 7th 05 01:07 PM
Selecting columns aspadda Excel Programming 1 December 9th 03 03:56 AM
Selecting Columns xnman Excel Programming 2 November 18th 03 01:52 PM


All times are GMT +1. The time now is 10:04 PM.

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

About Us

"It's about Microsoft Excel"