Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 12
Default Populate a form from a sheet in same workbook

I have a spreadsheet of parts data called Register. On a separate page, I've
created a form called OnHold form. Some of the cells in the OnHold form get
populated with information from data in the Register spreadsheet. The data
will always come from the same row and will always be from the last row.

I think I've figured out how to get to the last row of the Register sheet
(this in a commandbutton on the OnHold Sheet).
Dim rgLastCell As Range
Set rgLastCell = Sheet.Register.Range("A65536").End(xlUp)
Range("B9").Value = rgLastCell.Value

But maybe not. I want the last value in the last cell in Row A to go into
cell B9 in the OnHold form. Then I want the last value in the last cell of
Row B to go into cell G11, etc. I thought to just repeat the code above but
change the ranges, and I'm sure you know why it won't work, but I don't.

Can anyone help? I'm really new at macros in Excel.
Thanks,
DM


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 638
Default Populate a form from a sheet in same workbook

On Sep 24, 5:02 pm, Diana Morrison
wrote:
I have a spreadsheet of parts data called Register. On a separate page, I've
created a form called OnHold form. Some of the cells in the OnHold form get
populated with information from data in the Register spreadsheet. The data
will always come from the same row and will always be from the last row.

I think I've figured out how to get to the last row of the Register sheet
(this in a commandbutton on the OnHold Sheet).
Dim rgLastCell As Range
Set rgLastCell = Sheet.Register.Range("A65536").End(xlUp)
Range("B9").Value = rgLastCell.Value

But maybe not. I want the last value in the last cell in Row A to go into
cell B9 in the OnHold form. Then I want the last value in the last cell of
Row B to go into cell G11, etc. I thought to just repeat the code above but
change the ranges, and I'm sure you know why it won't work, but I don't.

Can anyone help? I'm really new at macros in Excel.
Thanks,
DM


untested:

Dim sourceWS As Worksheet
Dim rgLastCellRow As Long
Set sourceWS = Sheets("Register")
With sourceWS
rgLastCellRow = .Range("A65536").End(xlUp).Row
Range("B9").Value = .Cells(rgLastCellRow, 1).Text
Range("G11").Value = .Cells(rgLastCellRow, 2).Text
End With
Set sourceWS = Nothing

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 12
Default Populate a form from a sheet in same workbook

Fabulous. Thanks so much!

Diana

"JW" wrote:

On Sep 24, 5:02 pm, Diana Morrison
wrote:
I have a spreadsheet of parts data called Register. On a separate page, I've
created a form called OnHold form. Some of the cells in the OnHold form get
populated with information from data in the Register spreadsheet. The data
will always come from the same row and will always be from the last row.

I think I've figured out how to get to the last row of the Register sheet
(this in a commandbutton on the OnHold Sheet).
Dim rgLastCell As Range
Set rgLastCell = Sheet.Register.Range("A65536").End(xlUp)
Range("B9").Value = rgLastCell.Value

But maybe not. I want the last value in the last cell in Row A to go into
cell B9 in the OnHold form. Then I want the last value in the last cell of
Row B to go into cell G11, etc. I thought to just repeat the code above but
change the ranges, and I'm sure you know why it won't work, but I don't.

Can anyone help? I'm really new at macros in Excel.
Thanks,
DM


untested:

Dim sourceWS As Worksheet
Dim rgLastCellRow As Long
Set sourceWS = Sheets("Register")
With sourceWS
rgLastCellRow = .Range("A65536").End(xlUp).Row
Range("B9").Value = .Cells(rgLastCellRow, 1).Text
Range("G11").Value = .Cells(rgLastCellRow, 2).Text
End With
Set sourceWS = Nothing


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 12
Default Populate a form from a sheet in same workbook

Same spreadsheet, whole new problem...

Now they want to be able to place the cursor on any line in the register,
and populate the form with the info on that particular line.

Can you help?
Thanks
Diana

"Diana Morrison" wrote:

I have a spreadsheet of parts data called Register. On a separate page, I've
created a form called OnHold form. Some of the cells in the OnHold form get
populated with information from data in the Register spreadsheet. The data
will always come from the same row and will always be from the last row.

I think I've figured out how to get to the last row of the Register sheet
(this in a commandbutton on the OnHold Sheet).
Dim rgLastCell As Range
Set rgLastCell = Sheet.Register.Range("A65536").End(xlUp)
Range("B9").Value = rgLastCell.Value

But maybe not. I want the last value in the last cell in Row A to go into
cell B9 in the OnHold form. Then I want the last value in the last cell of
Row B to go into cell G11, etc. I thought to just repeat the code above but
change the ranges, and I'm sure you know why it won't work, but I don't.

Can anyone help? I'm really new at macros in Excel.
Thanks,
DM


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
Populate a form Doug Excel Worksheet Functions 3 December 15th 06 03:33 PM
How to enter data in one form & populate several others w/same. cmcpsych Excel Worksheet Functions 3 October 13th 06 01:45 AM
How to populate prices in sheet two based on cost in sheet one dstooch Excel Worksheet Functions 0 April 3rd 06 10:56 PM
Link a form field in a Word document to populate an excel spreads andrealdv Excel Discussion (Misc queries) 0 August 29th 05 09:47 PM
How do I select cells and make the info populate into a form? jompeters Excel Worksheet Functions 0 January 7th 05 09:43 PM


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