Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Code for moving textbox

I want to use a macro to shift a text box from one
position to another on the sheet. I was given the
following code:
Sheet1.TextBox1.Top=Sheet1.Range("B2").Top
Sheet1.TextBox1.Left=Sheet1.Range("B2").Left
When I execute the macro I get the message
METHOD OR DATA MEMBER NOT FOUND

Can someone advise what I am doing wrong here
Your help will be appreciated.
Thank you
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 280
Default Code for moving textbox

The only case where I get this error message is where TextBox1 doesn't exist
on Sheet1 in the workbook where the macro finds a Sheet1. Since most every
workbook has a Sheet1, I suggest you be more explicit about which Sheet1 you
mean by specifying the workbook. Here is one way:

Sub moveit()
With Workbooks("Book1.xls").Worksheets("Sheet1")
.TextBox1.Top = Sheet1.Range("B2").Top
.TextBox1.Left = Sheet1.Range("B2").Left
End With
End Sub

Bob Kilmer

"Phil Perry" wrote in message
...
I want to use a macro to shift a text box from one
position to another on the sheet. I was given the
following code:
Sheet1.TextBox1.Top=Sheet1.Range("B2").Top
Sheet1.TextBox1.Left=Sheet1.Range("B2").Left
When I execute the macro I get the message
METHOD OR DATA MEMBER NOT FOUND

Can someone advise what I am doing wrong here
Your help will be appreciated.
Thank you



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Code for moving textbox

The code worked fine for me.

Regards,
Tom Ogilvy

"Phil Perry" wrote in message
...
I want to use a macro to shift a text box from one
position to another on the sheet. I was given the
following code:
Sheet1.TextBox1.Top=Sheet1.Range("B2").Top
Sheet1.TextBox1.Left=Sheet1.Range("B2").Left
When I execute the macro I get the message
METHOD OR DATA MEMBER NOT FOUND

Can someone advise what I am doing wrong here
Your help will be appreciated.
Thank you



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
Calculate Textbox value based on another textbox value.doc Tdungate Excel Discussion (Misc queries) 1 February 12th 09 07:11 PM
Calculate Textbox value based on another textbox value Tdungate Excel Discussion (Misc queries) 0 February 12th 09 07:03 PM
CODE 4 MOVING WITHIN A RANGE-TAB FARAZ QURESHI Excel Discussion (Misc queries) 0 December 5th 07 10:23 AM
Arrow Keys Moving Window Frame instead of Moving Between Cells nemmex Excel Discussion (Misc queries) 2 April 9th 07 09:08 AM
Need VBA code to enter text into a textbox !!!! Art Ferdinand Excel Discussion (Misc queries) 1 May 6th 05 01:47 PM


All times are GMT +1. The time now is 01:35 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"