我希望下面的格式化单元格有更简单的代码。这段代码的目标是使一个盒子看起来更好一些,没有什么过于花哨,只是简单而且这段代码看起来并不简单。
<head>
<meta charset="utf-8">
<title>ShopWithMe</title>
<!--Browser icon, not working yet -->
<link rel="icon" type="image/vnd.microsoft.icon"
href="images/favicon.ico" />
<!-- Connect to Bootstrap CSS -->
<link rel="stylesheet" href="/bootstrap/css/bootstrap.css" />
<!-- Connect to Font Awesome CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" />
<!-- Connect to our own additional CSS -->
<link rel="stylesheet" href="/product_modal_styles.css" />
<link rel="stylesheet" href="/additional_styles.css" />
<link rel="stylesheet" href="/main.css" />
<link rel="stylesheet" href="/searchpage.css" />
<style>
/* Only necessary if you are using navbar-fixed-top */
body {
padding-top: 60px;
}
</style>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
/* social buttons */
<script type="text/javascript" src="//platform-api.sharethis.com/js/sharethis.js#property=596ffabf1328d800122d51d6&product=inline-share-buttons"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript">
var h = document.getElementsByTagName('head')[0];
(function(){
var fc = document.createElement('link'); fc.type = 'text/css'; fc.rel = 'stylesheet';
fc.href = 'https://product.feedbacklite.com/feedbacklite.css'; h.appendChild(fc);
})();
var fbl = {'campaign':{'id':2401, 'type':2, 'size':2, 'body':'666666', 'position':7, 'tab':1, 'control':1, 'auto':1, 'auto_delay':30000, 'auto_expiry':86400000, 'browser':'1234'}};
(function(){
var fj = document.createElement('script'); fj.type = 'text/javascript';
fj.async = true; fj.src = 'https://product.feedbacklite.com/feedbacklite.js'; h.appendChild(fj);
})();
</script>
<!-- from https://codepen.io/RetinaInc/pen/rxksh -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js"></script>
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
</head>
我用宏记录了很明显,然而,它非常笨重,我确信其中一些可以被取出,只是不确定什么可以拿出/不能被取出/修改。
提前致谢。
答案 0 :(得分:5)
试试这个。您也可以免除选择。最后的大部分格式可能都是多余的,除非您有以前的设置,并且看起来好像是由宏录制器生成的。
Sub x()
With Range("C17:C25")
With .Borders
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With .Font
.ColorIndex = xlAutomatic
.Name = "Arial"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
With .Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End With
With Range("A17:C25")
.BorderAround LineStyle:=xlContinuous, ColorIndex:=0, Weight:=xlMedium
With .Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
End With
End Sub
答案 1 :(得分:0)
我再次将它重新格式化为更简单的东西。我喜欢一些反馈,以确保我没有做任何禁忌。
With Range("C17:C25")
With .Borders
.LineStyle = xlContinuous
.Weight = xlThin
End With
With .Font
.ColorIndex = xlAutomatic
.Name = "Arial"
.Size = 12
End With
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
With .Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
End With
With Range("A17:C25")
.BorderAround LineStyle:=xlContinuous, Weight:=xlMedium
With .Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
End With
End With