Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 40
Default Excel 2003 visual basic for 'spinbutton'

i'm experimenting with 'spin buttons' and want each click of the button to
display an array of cells from another sheet .e.g click 1 displays A1:G15
from sheet1 and displays in sheet2, next click dislpays A16:G31 and so on. In
other words 'scrolling'
I can get it to work once but for the first click but not the second click.
What is the secret to the second, third etc. click to get the function i
require?
Am i using the correct button?
Ahhhhhh!

--
Browny
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 421
Default Excel 2003 visual basic for 'spinbutton'

Hi Browny,

In the worksheet module,
try something like:

'==========
Option Explicit
Private iOffset As Long

'--------------
Private Sub SpinButton1_SpinDown()
Dim SH As Worksheet
Dim Rng As Range
Dim Rng2 As Range
Dim i As Long

Set SH = ThisWorkbook.Sheets("Sheet2") '<<==== CHANGE

Set Rng = SH.Range("A1:G15")
i = Rng.Rows.Count
Set Rng2 = Rng.Offset(i * iOffset)

Application.Goto Reference:=Rng2, _
Scroll:=True

iOffset = iOffset + 1

End Sub

'--------------
Private Sub SpinButton1_SpinUp()
Dim SH As Worksheet
Dim Rng As Range
Dim i As Long

Set SH = ThisWorkbook.Sheets("Sheet2") '<<==== CHANGE
Set Rng = SH.Range("A1:G15")
i = Rng.Rows.Count

If Not iOffset = 0 Then
iOffset = iOffset - 1
End If
Set Rng2 = Rng.Offset(i * iOffset)

Application.Goto Reference:=Rng2, _
Scroll:=True

End Sub
'<<==========



---
Regards.
Norman
"Browny" wrote in message
...
i'm experimenting with 'spin buttons' and want each click of the button to
display an array of cells from another sheet .e.g click 1 displays A1:G15
from sheet1 and displays in sheet2, next click dislpays A16:G31 and so on.
In
other words 'scrolling'
I can get it to work once but for the first click but not the second
click.
What is the secret to the second, third etc. click to get the function i
require?
Am i using the correct button?
Ahhhhhh!

--
Browny


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 40
Default Excel 2003 visual basic for 'spinbutton'

Hi Norman

Im having trouble with it. Would it be too much to ask for a greater
explanation?

Im not sure where to substitute my data for that required by Vbasic.

To explain,

My spin button is in sheet2

By clicking on the spin button (up) I want to copy a selected group of cells
A1:Q12 from sheet1 and paste into sheet2 A5:Q17, when I spin (down) I want
another group of cells to be copied.

Ultimately Im looking to browse thru sheet1 by clicking the spin button
up/dwn and read the selected group of cells (from sheet1) in sheet2.

Im not even sure Im using the correct command (spin button) maybe theres
a better way,

Can you advise

--
Browny


"Norman Jones" wrote:

Hi Browny,

In the worksheet module,
try something like:

'==========
Option Explicit
Private iOffset As Long

'--------------
Private Sub SpinButton1_SpinDown()
Dim SH As Worksheet
Dim Rng As Range
Dim Rng2 As Range
Dim i As Long

Set SH = ThisWorkbook.Sheets("Sheet2") '<<==== CHANGE

Set Rng = SH.Range("A1:G15")
i = Rng.Rows.Count
Set Rng2 = Rng.Offset(i * iOffset)

Application.Goto Reference:=Rng2, _
Scroll:=True

iOffset = iOffset + 1

End Sub

'--------------
Private Sub SpinButton1_SpinUp()
Dim SH As Worksheet
Dim Rng As Range
Dim i As Long

Set SH = ThisWorkbook.Sheets("Sheet2") '<<==== CHANGE
Set Rng = SH.Range("A1:G15")
i = Rng.Rows.Count

If Not iOffset = 0 Then
iOffset = iOffset - 1
End If
Set Rng2 = Rng.Offset(i * iOffset)

Application.Goto Reference:=Rng2, _
Scroll:=True

End Sub
'<<==========



---
Regards.
Norman
"Browny" wrote in message
...
i'm experimenting with 'spin buttons' and want each click of the button to
display an array of cells from another sheet .e.g click 1 displays A1:G15
from sheet1 and displays in sheet2, next click dislpays A16:G31 and so on.
In
other words 'scrolling'
I can get it to work once but for the first click but not the second
click.
What is the secret to the second, third etc. click to get the function i
require?
Am i using the correct button?
Ahhhhhh!

--
Browny


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
visual basic compile error in excel 2003 poopscooper101 Excel Discussion (Misc queries) 2 March 7th 08 09:39 PM
Visual Basic module from Excel 2003 crashing in Excel 2007 Chuck Angier Excel Discussion (Misc queries) 0 December 4th 07 01:42 AM
Visual BASIC in Excel Emerogork via OfficeKB.com Excel Worksheet Functions 1 August 27th 07 04:53 PM
Visual Basic Function works fine in Excell 2003 but not in Excel 2 Roger Excel Discussion (Misc queries) 8 August 1st 07 03:56 AM
changing the visual basic in office 2003 to visual studio net bigdaddy3 Excel Discussion (Misc queries) 1 September 13th 05 10:57 AM


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