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

I seem to be at a lose to be able to get this to write data back to the
worksheet after the the TextBoxes have been edited.

Private Sub CommandButton1_Click()
Cells(rngArr(0).Row,(1, 7).Value = TextBox1.Value
Cells(rngArr(1).Row,(1, 7).Value = TextBox2.Value
Cells(rngArr(2).Row,(1, 7).Value = TextBox3.Value
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default rng propblem

Two things:

First you have to declare the RngArr() variable as public as below
(outside the module), and remove the related Dim statement:

Public rngArr() As Range

Second you have a syntax error in your macro, if values is to be
written back to column 7, then use this:

Private Sub CommandButton1_Click()
Cells(rngArr(0).Row, 7).Value = Me.TextBox1.Value
Cells(rngArr(1).Row, 7).Value = Me.TextBox2.Value
Cells(rngArr(2).Row, 7).Value = Me.TextBox3.Value
End Sub

Regards,
Per

On 25 Sep., 20:39, "Patrick C. Simonds" wrote:
I seem to be at a lose to be able to get this to write data back to the
worksheet after the the TextBoxes have been edited.

Private Sub CommandButton1_Click()
* *Cells(rngArr(0).Row,(1, 7).Value = TextBox1.Value
* *Cells(rngArr(1).Row,(1, 7).Value = TextBox2.Value
* *Cells(rngArr(2).Row,(1, 7).Value = TextBox3.Value
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default rng propblem

I thought about making rngArr() As Range public as well but when I do it I
get the following error:

Compile Error

Constants, fixed-length strings, arrays, user-defined types and Declare
Statements not allowed as Public members or object modules





"Per Jessen" wrote in message
...
Two things:

First you have to declare the RngArr() variable as public as below
(outside the module), and remove the related Dim statement:

Public rngArr() As Range

Second you have a syntax error in your macro, if values is to be
written back to column 7, then use this:

Private Sub CommandButton1_Click()
Cells(rngArr(0).Row, 7).Value = Me.TextBox1.Value
Cells(rngArr(1).Row, 7).Value = Me.TextBox2.Value
Cells(rngArr(2).Row, 7).Value = Me.TextBox3.Value
End Sub

Regards,
Per

On 25 Sep., 20:39, "Patrick C. Simonds" wrote:
I seem to be at a lose to be able to get this to write data back to the
worksheet after the the TextBoxes have been edited.

Private Sub CommandButton1_Click()
Cells(rngArr(0).Row,(1, 7).Value = TextBox1.Value
Cells(rngArr(1).Row,(1, 7).Value = TextBox2.Value
Cells(rngArr(2).Row,(1, 7).Value = TextBox3.Value
End Sub


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
If statement propblem Scott@CW Excel Discussion (Misc queries) 4 July 19th 07 09:23 PM
Propblem setting OnAction property at runtime Philip Excel Programming 2 January 26th 04 05:51 PM


All times are GMT +1. The time now is 08:37 PM.

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"