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

Hi,
I have a button on my userform called "save"

if clicked i would like to save some info on another sheet.

1. The button should look for the first empty cel in column "A" on sheet2
2. it should then put data in A1, B1, C1 etc. This data comes from cells A4,
A5, G5, G6 from sheet1

can anyone please help me with the code that does just this please?
thanks,
Pierre


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200509/1
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default offset problems

What kind of button--from the Forms toolbar or from the control toolbox toolbar.

Option Explicit
sub testme() 'forms button
Sub CommandButton1_Click() 'control toolbox toolbar
dim curWks as worksheet
dim savWks as worksheet
dim destcell as range

set curwks = activesheet 'if from the forms toolbar
set curwks = me 'if from control toolbox toolbar
set savwks = worksheets("sheet2")

with savwks
set destcell = .cells(.rows.count,"A").end(xlup).offset(1,0)
end with

with destcell
.value = curwks.range("a4")
.offset(0,1).value = curwks.range("A5").value
.offset(0,2).value = curwks.range("G5").value
.offset(0,3).value = curwks.range("G6").value
end with

end sub

I don't know what etc would mean...


"Pierre via OfficeKB.com" wrote:

Hi,
I have a button on my userform called "save"

if clicked i would like to save some info on another sheet.

1. The button should look for the first empty cel in column "A" on sheet2
2. it should then put data in A1, B1, C1 etc. This data comes from cells A4,
A5, G5, G6 from sheet1

can anyone please help me with the code that does just this please?
thanks,
Pierre

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200509/1


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 122
Default offset problems

Hi Dave,

you're my hero !

Thanks a lot, it works fine for me.
By the way:
etc. meant etcetera...
and the button was a forms toolbar button

Dave Peterson wrote:
What kind of button--from the Forms toolbar or from the control toolbox toolbar.

Option Explicit
sub testme() 'forms button
Sub CommandButton1_Click() 'control toolbox toolbar
dim curWks as worksheet
dim savWks as worksheet
dim destcell as range

set curwks = activesheet 'if from the forms toolbar
set curwks = me 'if from control toolbox toolbar
set savwks = worksheets("sheet2")

with savwks
set destcell = .cells(.rows.count,"A").end(xlup).offset(1,0)
end with

with destcell
.value = curwks.range("a4")
.offset(0,1).value = curwks.range("A5").value
.offset(0,2).value = curwks.range("G5").value
.offset(0,3).value = curwks.range("G6").value
end with

end sub

I don't know what etc would mean...


Hi,
I have a button on my userform called "save"

[quoted text clipped - 8 lines]
thanks,
Pierre




--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200509/1
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default offset problems

I actually knew what etc. meant as a word <vbg. I wasn't sure what you meant
when you used it--"A1, B1, C1 etc."

Did you want to stop at D1 or IV1?

But glad you could make the code do what you want.



"Pierre via OfficeKB.com" wrote:

Hi Dave,

you're my hero !

Thanks a lot, it works fine for me.
By the way:
etc. meant etcetera...
and the button was a forms toolbar button

Dave Peterson wrote:
What kind of button--from the Forms toolbar or from the control toolbox toolbar.

Option Explicit
sub testme() 'forms button
Sub CommandButton1_Click() 'control toolbox toolbar
dim curWks as worksheet
dim savWks as worksheet
dim destcell as range

set curwks = activesheet 'if from the forms toolbar
set curwks = me 'if from control toolbox toolbar
set savwks = worksheets("sheet2")

with savwks
set destcell = .cells(.rows.count,"A").end(xlup).offset(1,0)
end with

with destcell
.value = curwks.range("a4")
.offset(0,1).value = curwks.range("A5").value
.offset(0,2).value = curwks.range("G5").value
.offset(0,3).value = curwks.range("G6").value
end with

end sub

I don't know what etc would mean...


Hi,
I have a button on my userform called "save"

[quoted text clipped - 8 lines]
thanks,
Pierre



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200509/1


--

Dave Peterson
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
OFFSET Problems John V[_2_] Excel Worksheet Functions 3 May 26th 09 05:49 PM
Offset/COUNTA problems [email protected] Excel Worksheet Functions 4 June 17th 08 03:22 PM
Problems with offset/average formula GaryC Excel Worksheet Functions 8 March 15th 06 07:14 PM
Problems copying cells using offset and counta hlckom Excel Discussion (Misc queries) 4 January 30th 05 12:49 AM
offset problems cornishbloke[_9_] Excel Programming 6 December 30th 03 10:36 AM


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