![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Huntington Beach, CA USA
Posts: 327
|
Hi group,
I'm trying to with a commmandbutton search cells Q6:Q1000 and find the cells that are formatted as accounting with the $ symbol and change the "borders" to Selection.Borders (xlEdgeBotton).Linestyle = xlNone Any help would be appreciated James |
|
|
|
|
|
#2 |
|
Join Date: Mar 2002
Posts: 372
|
try this ;-
Dim rng1 As Range, rng2 As Range Application.ScreenUpdating = False Columns("Q:Q").Insert Set rng1 = [Q6:Q1000] rng1.FormulaR1C1 = "=IF(CELL(""format"",RC[1])=""C2"",1,"""")" On Error GoTo e Set rng2 = rng1.SpecialCells(xlCellTypeFormulas, 1) With rng2.Offset(0, 1) .Borders(xlEdgeBottom).LineStyle = xlNone .Borders(xlInsideHorizontal).LineStyle = xlNone End With e: On Error GoTo 0 Columns("Q:Q").Delete cojones [ This Message was edited by: C. O. Jones on 2002-03-31 18:39 ] [ This Message was edited by: C. O. Jones on 2002-03-31 18:39 ] |
|
|
|
|
|
#3 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
Sub Macro1() Dim MyRg As Range Dim oCell As Range Set MyRg = Range("Q6:Q1000") On Error Resume Next Set MyRg = Application.Union(MyRg.SpecialCells(xlCellTypeFormulas, 1), _ MyRg.SpecialCells(xlCellTypeConstants, 1)) If Err Then MsgBox "No Data Cells": End For Each oCell In MyRg If oCell.Style = "Currency" Then With oCell.Borders(9) .LineStyle = xlNone End With End If Next Set MyRg = Nothing End Sub |
|
|
|
|
|
|
#4 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
Sorry your post was ahead of mine didn't mean to post over it... |
|
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Location: Huntington Beach, CA USA
Posts: 327
|
Thanks for the code Ivan, it works great!
James |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|