Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Stubborn array wont change destination worksheet - HELP! (reposteddue to incorrect formatting)

I have tried everything but the array stubbornly refuses to populate
any sheet except the one the code belongs to:

Sub WontChangeWorksheetDestination()

Dim wks As Worksheet
Set wks = Sheets(3)

With wks

Set TheRange = Range(Cells(1, 1), Cells(10, 10))

TheRange.Value = MyArray

End With

End sub

I've tried everything, but because the code is behind a button on
sheet 1 the array populates sheet 1 and doesn't seem to want to
populate any toher sheet no mattwer hw I try to qualify it ... what am
I missing?

Any help gratefully accepted,

Kind regards, Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 259
Default Stubborn array wont change destination worksheet - HELP! (reposteddue to incorrect formatting)

On 4/06/2012 3:32 AM, dial13 wrote:
I have tried everything but the array stubbornly refuses to populate
any sheet except the one the code belongs to:

Sub WontChangeWorksheetDestination()

Dim wks As Worksheet
Set wks = Sheets(3)

With wks

Set TheRange = Range(Cells(1, 1), Cells(10, 10))

TheRange.Value = MyArray

End With

End sub

I've tried everything, but because the code is behind a button on
sheet 1 the array populates sheet 1 and doesn't seem to want to
populate any toher sheet no mattwer hw I try to qualify it ... what am
I missing?

Any help gratefully accepted,

Kind regards, Mark

Hi

Not sure about your use of MyArray as you have not declared it, unless
you have it Globally Declared somewhere else in your workbook.

Try

Dim wks As Worksheet
Dim TheRange as Range
Set wks = Sheets(3)
Set TheRange = wks.Range(Cells(1, 1), Cells(10, 10))
with TheRange
.Value = MyArray
End With
End Sub

HTH
Mick.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Stubborn array wont change destination worksheet - HELP!(reposted due to incorrect formatting)

You need to link the Cells() statements back to the tarket worksheet.
Do not use "wks.range". Instead do this:

range(wks.cells(1,1), wks.cells(10,10))

or

with wks
range(.cells(1,1), cells(10,10))
end with

Without the link back to wks, Cells() will refer to the active
worksheet only. And if you qualify Range with wks, that doesn't
change what Cells() is referring to

Robert Flanagan
Add-ins.com LLC
144 Dewberry Drive
Hockessin, Delaware, U.S. 19707

Phone: 302-234-9857, fax 302-234-9859
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel


On Jun 4, 7:36*am, Vacuum Sealed wrote:
On 4/06/2012 3:32 AM, dial13 wrote:



I have tried everything but the array stubbornly refuses to populate
any sheet except the one the code belongs to:


Sub WontChangeWorksheetDestination()


Dim wks As Worksheet
Set wks = Sheets(3)


With wks


Set TheRange = Range(Cells(1, 1), Cells(10, 10))


TheRange.Value = MyArray


End With


End sub


I've tried everything, but because the code is behind a button on
sheet 1 the array populates sheet 1 and doesn't seem to want to
populate any toher sheet no mattwer hw I try to qualify it ... what am
I missing?


Any help gratefully accepted,


Kind regards, Mark


Hi

Not sure about your use of MyArray as you have not declared it, unless
you have it Globally Declared somewhere else in your workbook.

Try

Dim wks As Worksheet
Dim TheRange as Range
Set wks = Sheets(3)
Set TheRange = wks.Range(Cells(1, 1), Cells(10, 10))
with TheRange
* * * * .Value = MyArray
End With
End Sub

HTH
Mick.- Hide quoted text -

- Show quoted text -


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
Stubborn cell formatting. m_joy Excel Worksheet Functions 1 September 27th 09 06:23 PM
Excel 2007 formatting wont change in column wx4usa Excel Discussion (Misc queries) 4 October 30th 08 05:34 PM
change date formatting in destination cell Melody Excel Discussion (Misc queries) 2 February 21st 08 06:36 PM
Date format from excel to CVS file wont. Change in CVS wont stay. Fish''s Mermaid Excel Worksheet Functions 1 October 14th 06 12:28 AM
HDI change paste options default to "Match Destination Formatting HAT3 Setting up and Configuration of Excel 0 May 4th 06 02:51 PM


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