Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default Save Textbox into Named Range

Hi,

I have a group of textboxes who's values I am trying to save into a named
range. I am also trying to save a value from a listbox into the same named
range. I am unable to get this to save to the worksheet.

What am I missing?

Thanks for your help.

Private Sub cmdSave_Click()

Dim ws As Worksheet
Dim Choice As Long
Dim Msg As String

Set ws = MainPagepg

'add 1 as listbox index begins at 0
Choice = lboChoseTenant.ListIndex + 1

'Check for a selection made
If Me.lboChoseTenant.ListIndex = -1 Then
Msg = "Please make a selection"
MsgBox Msg
Me.lboChoseTenant.SetFocus
Exit Sub
End If

With ws 'save any changes

'save the vacant status
Range("Tenants").Item(Choice, 1).Value = Me.lboVacant.ListIndex.Value

'save Tenants Name
Range("Tenants").Item(Choice, 4).Value = Me.txtTenantName

'Save Primary Unit Number
Range("Tenants").Item(Choice, 2).Value = Me.txtPrimaryUnitNo

'Save Additional Unit Numbers
Range("Tenants").Item(Choice, 4).Value = Me.txtAddUnitNos

'save Days Occupied
Range("Tenants").Item(Choice, 7).Value = Me.txtDaysOccupied

End With

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default Save Textbox into Named Range

Hi,

I think the problem here is not that this isn't saving but that if they
overtype the information displayed in the textbox to change it it's not
saving that change. Is there a way to update the textbox for the user's
change?

Thanks,



"Karen53" wrote:

Hi,

I have a group of textboxes who's values I am trying to save into a named
range. I am also trying to save a value from a listbox into the same named
range. I am unable to get this to save to the worksheet.

What am I missing?

Thanks for your help.

Private Sub cmdSave_Click()

Dim ws As Worksheet
Dim Choice As Long
Dim Msg As String

Set ws = MainPagepg

'add 1 as listbox index begins at 0
Choice = lboChoseTenant.ListIndex + 1

'Check for a selection made
If Me.lboChoseTenant.ListIndex = -1 Then
Msg = "Please make a selection"
MsgBox Msg
Me.lboChoseTenant.SetFocus
Exit Sub
End If

With ws 'save any changes

'save the vacant status
Range("Tenants").Item(Choice, 1).Value = Me.lboVacant.ListIndex.Value

'save Tenants Name
Range("Tenants").Item(Choice, 4).Value = Me.txtTenantName

'Save Primary Unit Number
Range("Tenants").Item(Choice, 2).Value = Me.txtPrimaryUnitNo

'Save Additional Unit Numbers
Range("Tenants").Item(Choice, 4).Value = Me.txtAddUnitNos

'save Days Occupied
Range("Tenants").Item(Choice, 7).Value = Me.txtDaysOccupied

End With

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default Save Textbox into Named Range

Hi

Never mind. I think I've got it.

Thanks




"Karen53" wrote:

Hi,

I have a group of textboxes who's values I am trying to save into a named
range. I am also trying to save a value from a listbox into the same named
range. I am unable to get this to save to the worksheet.

What am I missing?

Thanks for your help.

Private Sub cmdSave_Click()

Dim ws As Worksheet
Dim Choice As Long
Dim Msg As String

Set ws = MainPagepg

'add 1 as listbox index begins at 0
Choice = lboChoseTenant.ListIndex + 1

'Check for a selection made
If Me.lboChoseTenant.ListIndex = -1 Then
Msg = "Please make a selection"
MsgBox Msg
Me.lboChoseTenant.SetFocus
Exit Sub
End If

With ws 'save any changes

'save the vacant status
Range("Tenants").Item(Choice, 1).Value = Me.lboVacant.ListIndex.Value

'save Tenants Name
Range("Tenants").Item(Choice, 4).Value = Me.txtTenantName

'Save Primary Unit Number
Range("Tenants").Item(Choice, 2).Value = Me.txtPrimaryUnitNo

'Save Additional Unit Numbers
Range("Tenants").Item(Choice, 4).Value = Me.txtAddUnitNos

'save Days Occupied
Range("Tenants").Item(Choice, 7).Value = Me.txtDaysOccupied

End With

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
macro to save named range as text GFN Excel Programming 3 September 13th 06 06:09 AM
inserting a named range into new cells based on a named cell Peter S. Excel Discussion (Misc queries) 1 June 4th 06 03:53 AM
Determining whether a named textbox on a chart exists P. Dua-Brown Excel Programming 4 October 20th 05 03:31 PM
If any cell in named range = 8 then shade named range JJ[_8_] Excel Programming 3 August 26th 05 11:09 PM
How do I set the value of a textbox on a userform to the value in a named cell? CR[_3_] Excel Programming 2 August 26th 03 03:50 AM


All times are GMT +1. The time now is 03:01 AM.

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"