Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 66
  • Last Modified:

What is wrong with this code

Hi

Could somebody please help with the below code. When this is run it returns FALSE


    ActiveCell.Offset(-1, 0).Range("A1").Select
    ActiveCell.FormulaR1C1 = _
    Selection.NumberFormat = "_($* #,##0.00_);_($* (#,##0.00);_($* ""-""??_);_(@_)"
    Selection.Style = "Currency"
    Selection.Font.Bold = True
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    Selection.Borders(xlEdgeLeft).LineStyle = xlNone
    Selection.Borders(xlEdgeTop).LineStyle = xlNone
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    Selection.Borders(xlEdgeRight).LineStyle = xlNone
    Selection.Borders(xlInsideVertical).LineStyle = xlNone
    Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
    Workbooks.Item("Main Data Sheet.xls").Close
 
What we want it to do is just format the cell as currency, bold & underline.

Thanks in advance

Ajae
0
ajaeclarke
Asked:
ajaeclarke
  • 3
  • 2
1 Solution
 
ProfessorJimJamCommented:
Use only this part
Select cells and then run this

Sub test ()
Selection.NumberFormat = "_($* #,##0.00_);_($* (#,##0.00);_($* ""-""??_);_(@_)"
    Selection.Style = "Currency"
    Selection.FNot.bold=true
End sub
0
 
ajaeclarkeAuthor Commented:
Hi ProfessorJimJam
Sorry....where should I be putting that part?
0
 
Rgonzo1971Commented:
Hi,

You should replace all the text between the lines Sub (something) and End Sub of your code

with

Selection.NumberFormat = "_($* #,##0.00_);_($* (#,##0.00);_($* ""-""??_);_(@_)"
    Selection.Style = "Currency"
    Selection.Font.Bold=True

Regards
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
ProfessorJimJamCommented:
You need to copy this code and paste it in a module

if you do not know how to insert a module. then please see attached word document.

Sub test()

Selection.NumberFormat = "_($* #,##0.00_);_($* (#,##0.00);_($* ""-""??_);_(@_)"
    Selection.Style = "Currency"
    Selection.Font.Bold = True
End Sub

Open in new window

InsertMod.docx
0
 
ajaeclarkeAuthor Commented:
Sorry I wasn't very clear. We need the rest of the code as is. We just don't know why it is returning FALSE.
0
 
ajaeclarkeAuthor Commented:
Sorry for the delay in getting back to this.

Thanks for the help and got it working like ProfessorJimJam suggested.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now