Placing array into another sheet without selecting

Reset

Board Regular
Joined
Apr 16, 2010
Messages
227
Is it possible to place an array into a non-active sheet? i am working in one sheet and generate an integer array, and want to place it in a different sheet but stay onthe current sheet. Right now I am doing:

a = Application.WorksheetFunction.CountA(Columns(1))
b = Application.WorksheetFunction.CountA(Columns(2))
ReDim q(a - b) As Integer
inc = 0
For x = 1 To a
If Cells(x, 2) = "" Then q(inc) = Cells(x, 1): inc = inc + 1
Next x
Set t = Range(Cells(1, 4), Cells(a - b, 4))
t.Value = Application.Transpose(q)
' would like to transposte to sheet named "data"

In other words, I want to place it on a different sheet from the active one but don't want to have the "flash" of selecting a different sheet, pasting, and coming back. Any way to put the array on the "data" sheet but staying on the currrent one?
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Perhaps this:-
Code:
Private Sub CommandButton1_Click()
Dim a, b, x, inc, t
a = Application.WorksheetFunction.CountA(Columns(1))
b = Application.WorksheetFunction.CountA(Columns(2))
ReDim Q(a - b) As Integer
inc = 0
For x = 1 To a
If Cells(x, 2) = "" Then Q(inc) = Cells(x, 1): inc = inc + 1
Next x
With Sheets("Data")
Set t = .Range(.Cells(1, 4), .Cells(a - b, 4))
End With
t.Value = Application.Transpose(Q)
' would like to transposte to sheet named "data"
End Sub
or this:-
Code:
Private Sub CommandButton2_Click()
Dim rng As Range
Set rng = Range("B:B").SpecialCells(xlCellTypeBlanks, 21).Offset(, -1)
rng.Copy Sheets("Data").Range("F1")
End Sub
Mick
 
Upvote 0

Forum statistics

Threads
1,224,534
Messages
6,179,390
Members
452,909
Latest member
VickiS

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top