VB code

  • Thread starter Thread starter kevin carter
  • Start date Start date
K

kevin carter

Hi

i have a workbook that has some sheet code that formats the worksheet
problem is i have to click in a cell to activate the sheet code.

if i select a cell in VB code this causes the macros /sheet code to crash.
The cell remains selected stopping me pasting values into the worksheet.

i need a cell to be selected(update format) then i need the cell
deselected(allowing me to paste vlaues onto worksheet)

Is there any way of de selecting the a cell in VB code?


Kevin
 
Kevin,

I think it would help to see the code.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Private Sub Workbook_Open()
On Error Resume Next
ThisWorkbook.Worksheets("VALUES").Visible = xlSheetVisible
ThisWorkbook.Worksheets("VALUES").Select
Range("a1").Select
ThisWorkbook.Worksheets("VALUES").Visible = xlHidden

ThisWorkbook.Worksheets("count").Select
Range("bs6").Select
ActiveCell("bs6").Deselect (attempting to deselect the cell)
ThisWorkbook.Worksheets("trans").Visible = xlHidden
End Sub
 
Kevin ,

I can't say that I understand what the code is meant to do, or what you want
to do. For in stance, what does this mean '... I need a cell to be
selected(update format) then I need the cell deselected(allowing me to paste
values onto worksheet)...'.

All I can say is that Deselect refers to a chart object, not a range. A cell
is deselected by selecting another.


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top