Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA - forms

Hi

I have a problem with a VBA form I've created in Excel. I have set u
an OK button which, when clicked, takes the information that has bee
inputted on the form and puts it on to a worksheet.

Here is a sample of the code:

Range("c1").select
ActiveCell.Offset(0, 1) = txtCountry.Value
ActiveCell.Offset(0, 2) = txtRegion.Value
ActiveCell.Offset(0, 3) = txtStreet.Value
ActiveCell.Offset(0, 4) = txtName.Value

where txtCountry etc are the fields on the form.

When I run this macro, it goes incredibly slowly, although correctly
Although it is a reasonably large spreadsheet, I do have a fas
computer and I would not expect this. It is taking about half a secon
to add each item.

Any ideas as to why this is happening would be greatly appreciated.

Thanks
Jame

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Excel VBA - forms

Hi James,

Not enough info as to why it is so slow, but you could try this to speed it
up.

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

With Range("c1")
.Offset(0, 1) = txtCountry.Value
.Offset(0, 2) = txtRegion.Value
.Offset(0, 3) = txtStreet.Value
.Offset(0, 4) = txtName.Value
End With

Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"James Wilkinson " wrote in
message ...
Hi

I have a problem with a VBA form I've created in Excel. I have set up
an OK button which, when clicked, takes the information that has been
inputted on the form and puts it on to a worksheet.

Here is a sample of the code:

Range("c1").select
ActiveCell.Offset(0, 1) = txtCountry.Value
ActiveCell.Offset(0, 2) = txtRegion.Value
ActiveCell.Offset(0, 3) = txtStreet.Value
ActiveCell.Offset(0, 4) = txtName.Value

where txtCountry etc are the fields on the form.

When I run this macro, it goes incredibly slowly, although correctly.
Although it is a reasonably large spreadsheet, I do have a fast
computer and I would not expect this. It is taking about half a second
to add each item.

Any ideas as to why this is happening would be greatly appreciated.

Thanks
James


---
Message posted from http://www.ExcelForum.com/



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
sub forms in excel? jackrobyn1 Excel Discussion (Misc queries) 8 April 5th 23 01:22 PM
excel forms piper Excel Discussion (Misc queries) 1 October 11th 08 06:05 PM
forms in Excel Allison Excel Discussion (Misc queries) 1 October 24th 06 11:21 PM
forms in excel gautam.mahendru Excel Worksheet Functions 1 October 24th 05 04:01 PM
excel forms paer Excel Programming 0 September 15th 03 03:27 AM


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