SendKeys Down, Not Working

emacjake

New Member
Joined
Nov 4, 2014
Messages
29
Hi

I'm writing a macro that copy's and pastes values in filtered data

I want to copy the price of something to an adjacent column as a value, which is easy in the first column, but i'm trying to then select the next visible cell below and do the same
with :

SendKeys ("{DOWN}")

but nothing happens when stepping through the macro it goes passed this step and no change to the active sheet?


Any ideas how i can get this to work? without looping through [FONT=&quot]EntireRow.Hidden = False, as the sheet is 5000 rows long

[/FONT]
Cheers
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
That is not a preferred method of selecting the next cell. I rarely have ever used the SendKeys command. Here's a SUB you can use. Just call it from whithin your macro. The Test sub explains how to call the sub. Rng is returned and used to either select the next visible cell or just use it as a reference.

Code:
Sub SelectNextVisibleCell(Rng As Range)
  Dim Cel As Range
  For Each Cel In Range(Rng.Offset(1, 0), Rng.Offset(1000, 0))
    If Cel.EntireRow.Hidden = False Then
      Set Rng = Cel
      Exit Sub
    End If
  Next Cel
End Sub


Sub TestNextCel()
  Dim Rng As Range
  Set Rng = ActiveCell
  Call SelectNextVisibleCell(Rng)
  Rng.Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,557
Members
449,088
Latest member
davidcom

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