运行时错误'1004',已经研究并尝试了几个推荐的解决方案无济于事(Run Time Error '1004', have researched and tried several recommended solutions to no avail)
我试图用公式填充范围并继续得到运行时错误'1004'。 错误发生在我已加星标表格的行(“预测”)。范围(“H125”)。公式= formulaTest 。 我的Sub中的代码如下:
Sub FirmShareFill() Dim RampUp As Range Dim RampBas As Range Dim RampDn As Range Dim Numbering As Range Dim Approval As Range Dim PeakShare As Range Dim tcount As Byte Dim bcount As Byte Dim ubdcount As Byte Dim yearRange2 As Byte year = Worksheets("Inputs").Range("B6").Value cntry = Worksheets("Inputs").Range("B5").Value bnd = Worksheets("Inputs").Range("B3").Value typ = Worksheets("Inputs").Range("B2").Value cat = Worksheets("Inputs").Range("B4").Value tcount = bnd * cat + bnd ubdcount = tcount * 2 + 1 yearCount = year * 4 - 1 For ubd = 1 To 3 For t = 1 To typ For b = 1 To bnd For c = 1 To cat For i = 1 To cntry Set RampUp = Columns(7).Find(What:="Ramp_Up" & i, MatchCase:=True).Offset(0, 1) Set RampBas = Columns(7).Find(What:="Ramp_Bas" & i, MatchCase:=True).Offset(0, 1) Set RampDn = Columns(7).Find(What:="Ramp_Dn" & i, MatchCase:=True).Offset(0, 1) Set Numbering = Sheets("Inputs").Range("B13") Set Approval = Columns(6).Find(What:="Approval", MatchCase:=True).Offset(i, 2 + ubd) bcount = c + (cat + 1) * (b - 1) If t = 1 And b = 1 And ubd = 1 Then Set PeakShare = Columns(5).Find(What:="Peak Share", MatchCase:=True).Offset(4 + i, c) ElseIf t = 1 And b > 1 And ubd = 1 Then Set PeakShare = Columns(5).Find(What:="Peak Share" & c, MatchCase:=True).Offset(4 + i, bcount) ElseIf t > 1 And b = 1 And ubd = 1 Then Set PeakShare = Columns(5).Find(What:="Peak Share" & c, MatchCase:=True).Offset(4 + i, c + tcount) ElseIf t > 1 And b > 1 And ubd = 1 Then Set PeakShare = Columns(5).Find(What:="Peak Share" & c, MatchCase:=True).Offset(4 + i, tcount + bcount) ElseIf t = 1 And b = 1 And ubd = 2 Then Set PeakShare = Columns(5).Find(What:="Peak Share", MatchCase:=True).Offset(4 + i, c + ubdcount) ElseIf t = 1 And b > 1 And ubd = 1 Then Set PeakShare = Columns(5).Find(What:="Peak Share" & c, MatchCase:=True).Offset(4 + i, bcount + ubdcount) ElseIf t > 1 And b = 1 And ubd = 1 Then Set PeakShare = Columns(5).Find(What:="Peak Share" & c, MatchCase:=True).Offset(4 + i, c + tcount + ubdcount) ElseIf t > 1 And b > 1 And ubd = 1 Then Set PeakShare = Columns(5).Find(What:="Peak Share" & c, MatchCase:=True).Offset(4 + i, tcount + bcount + ubdcount) ElseIf t = 1 And b = 1 And ubd = 3 Then Set PeakShare = Columns(5).Find(What:="Peak Share", MatchCase:=True).Offset(4 + i, c + 2 * ubdcount) ElseIf t = 1 And b > 1 And ubd = 3 Then Set PeakShare = Columns(5).Find(What:="Peak Share" & c, MatchCase:=True).Offset(4 + i, bcount + 2 * ubdcount) ElseIf t > 1 And b = 1 And ubd = 3 Then Set PeakShare = Columns(5).Find(What:="Peak Share" & c, MatchCase:=True).Offset(4 + i, c + tcount + 2 * ubdcount) ElseIf t > 1 And b > 1 And ubd = 3 Then Set PeakShare = Columns(5).Find(What:="Peak Share" & c, MatchCase:=True).Offset(4 + i, tcount + bcount + 2 * ubdcount) End If Dim formulaTest As String formulaTest = "=IF(" & Numbering.Address(False, False) & "<" & Approval.Address & ","", " & PeakShare.Address & " * " & RampUp.Address & ")" If ubd = 1 Then **Sheets("Forecast").Range("H125").Formula = formulaTest** ActiveCell.Offset(1, 0).Select ElseIf ubd = 2 Then Range(ActiveCell, ActiveCell.Offset(0, yearRange2)).Formula = "=IF(" & Numbering.Address(False, False) & " < " & Approval.Offset(1, 0).Address & ","", " & PeakShare.Address & " * " & RampBas.Address & "" ElseIf ubd = 3 Then Range(ActiveCell, ActiveCell.Offset(0, yearRange2)).Formula = "=IF(" & Numbering.Address(False, False) & " < " & Approval.Offset(1, 0).Address & ","", " & PeakShare.Address & " * " & RampDn.Address & "" End If Next i ActiveCell.Offset(1, 0).Select Next c Next b Next t Next ubd End Sub
我相信错误可能与我如何宣布范围“编号”范围有关,但到目前为止我一直无法弄明白。 我已多次在同一张纸上使用此代码,唯一的区别是我在另一张纸上设置了一个范围,编号。
I am trying to fill a range with a formula and continue to get a runtime error '1004'. The error occurs at the line I have starred Sheets("Forecast").Range("H125").Formula = formulaTest. The code in my Sub is as follows:
Sub FirmShareFill() Dim RampUp As Range Dim RampBas As Range Dim RampDn As Range Dim Numbering As Range Dim Approval As Range Dim PeakShare As Range Dim tcount As Byte Dim bcount As Byte Dim ubdcount As Byte Dim yearRange2 As Byte year = Worksheets("Inputs").Range("B6").Value cntry = Worksheets("Inputs").Range("B5").Value bnd = Worksheets("Inputs").Range("B3").Value typ = Worksheets("Inputs").Range("B2").Value cat = Worksheets("Inputs").Range("B4").Value tcount = bnd * cat + bnd ubdcount = tcount * 2 + 1 yearCount = year * 4 - 1 For ubd = 1 To 3 For t = 1 To typ For b = 1 To bnd For c = 1 To cat For i = 1 To cntry Set RampUp = Columns(7).Find(What:="Ramp_Up" & i, MatchCase:=True).Offset(0, 1) Set RampBas = Columns(7).Find(What:="Ramp_Bas" & i, MatchCase:=True).Offset(0, 1) Set RampDn = Columns(7).Find(What:="Ramp_Dn" & i, MatchCase:=True).Offset(0, 1) Set Numbering = Sheets("Inputs").Range("B13") Set Approval = Columns(6).Find(What:="Approval", MatchCase:=True).Offset(i, 2 + ubd) bcount = c + (cat + 1) * (b - 1) If t = 1 And b = 1 And ubd = 1 Then Set PeakShare = Columns(5).Find(What:="Peak Share", MatchCase:=True).Offset(4 + i, c) ElseIf t = 1 And b > 1 And ubd = 1 Then Set PeakShare = Columns(5).Find(What:="Peak Share" & c, MatchCase:=True).Offset(4 + i, bcount) ElseIf t > 1 And b = 1 And ubd = 1 Then Set PeakShare = Columns(5).Find(What:="Peak Share" & c, MatchCase:=True).Offset(4 + i, c + tcount) ElseIf t > 1 And b > 1 And ubd = 1 Then Set PeakShare = Columns(5).Find(What:="Peak Share" & c, MatchCase:=True).Offset(4 + i, tcount + bcount) ElseIf t = 1 And b = 1 And ubd = 2 Then Set PeakShare = Columns(5).Find(What:="Peak Share", MatchCase:=True).Offset(4 + i, c + ubdcount) ElseIf t = 1 And b > 1 And ubd = 1 Then Set PeakShare = Columns(5).Find(What:="Peak Share" & c, MatchCase:=True).Offset(4 + i, bcount + ubdcount) ElseIf t > 1 And b = 1 And ubd = 1 Then Set PeakShare = Columns(5).Find(What:="Peak Share" & c, MatchCase:=True).Offset(4 + i, c + tcount + ubdcount) ElseIf t > 1 And b > 1 And ubd = 1 Then Set PeakShare = Columns(5).Find(What:="Peak Share" & c, MatchCase:=True).Offset(4 + i, tcount + bcount + ubdcount) ElseIf t = 1 And b = 1 And ubd = 3 Then Set PeakShare = Columns(5).Find(What:="Peak Share", MatchCase:=True).Offset(4 + i, c + 2 * ubdcount) ElseIf t = 1 And b > 1 And ubd = 3 Then Set PeakShare = Columns(5).Find(What:="Peak Share" & c, MatchCase:=True).Offset(4 + i, bcount + 2 * ubdcount) ElseIf t > 1 And b = 1 And ubd = 3 Then Set PeakShare = Columns(5).Find(What:="Peak Share" & c, MatchCase:=True).Offset(4 + i, c + tcount + 2 * ubdcount) ElseIf t > 1 And b > 1 And ubd = 3 Then Set PeakShare = Columns(5).Find(What:="Peak Share" & c, MatchCase:=True).Offset(4 + i, tcount + bcount + 2 * ubdcount) End If Dim formulaTest As String formulaTest = "=IF(" & Numbering.Address(False, False) & "<" & Approval.Address & ","", " & PeakShare.Address & " * " & RampUp.Address & ")" If ubd = 1 Then **Sheets("Forecast").Range("H125").Formula = formulaTest** ActiveCell.Offset(1, 0).Select ElseIf ubd = 2 Then Range(ActiveCell, ActiveCell.Offset(0, yearRange2)).Formula = "=IF(" & Numbering.Address(False, False) & " < " & Approval.Offset(1, 0).Address & ","", " & PeakShare.Address & " * " & RampBas.Address & "" ElseIf ubd = 3 Then Range(ActiveCell, ActiveCell.Offset(0, yearRange2)).Formula = "=IF(" & Numbering.Address(False, False) & " < " & Approval.Offset(1, 0).Address & ","", " & PeakShare.Address & " * " & RampDn.Address & "" End If Next i ActiveCell.Offset(1, 0).Select Next c Next b Next t Next ubd End Sub
I believe the error may have something to do with how I declared the range "numbering" range, but as of yet I have been unable to figure it out. I have used this code on the same sheet many times, the only difference being that I have set a range, numbering, on a different sheet.
原文:https://stackoverflow.com/questions/42536691
最满意答案
我不确定你是否在寻找
- 使用标题和HTML代码通过Wordpress编辑器进行快速修复
- 通过Wordpress html编辑器快速修复手动重新创建字幕代码
- 通过functions.php文件和wp-includes / media.php中的add_shortcode()进行永久性修复
- 通过CSS永久修复可能会影响所有标题。
我尽量保持你的代码不受影响
<div style="text-align:center;"> // This should align the entire block [it worked for me at least] <div style="display:inline-block;"> <div style="float:left;"> // Takes care of the centering down the middle [caption align="aligncenter" width="150" caption="Protein rest"] <a href="http://www.mysite.com/wp-content/uploads/2008/06/protein-rest.jpg"> <img title="Mash during protein rest" src="http://www.mysite.com/wp-content/uploads/2008/06/protein-rest-150x144.jpg" alt="Mash during protein rest" width="150" height="144" /> </a>[/caption] //Your caption code above with alignnone changed to aligncenter </div> <div style="float:left;"> [caption align="aligncenter" width="143" caption="Saccharification rest" captionalign="center"] <a href="http://www.mysite.com/wp-content/uploads/2008/06/saccharification-rest.jpg"> <img title="Mash during saccharification rest" src="http://www.mysite.com/wp-content/uploads/2008/06/saccharification-rest-143x150.jpg" alt="Mash during saccharification rest" width="143" height="150" /> </a>[/caption] </div> </div> // End the Block Div </div> // End the Center Div
[编辑:刚刚看到你回答了自己 - .-无论如何发帖:D]
I am not sure whether you are looking for
- A Quick Fix via Wordpress Editor using the caption and html code
- A Quick Fix via Wordpress html Editor recreating the caption code by hand
- A Permanent fix via the functions.php file and the add_shortcode() in wp-includes/media.php
- A Permanent Fix via CSS which might affect all captions.
I am giving 1 keeping your code as untouched as possible
<div style="text-align:center;"> // This should align the entire block [it worked for me at least] <div style="display:inline-block;"> <div style="float:left;"> // Takes care of the centering down the middle [caption align="aligncenter" width="150" caption="Protein rest"] <a href="http://www.mysite.com/wp-content/uploads/2008/06/protein-rest.jpg"> <img title="Mash during protein rest" src="http://www.mysite.com/wp-content/uploads/2008/06/protein-rest-150x144.jpg" alt="Mash during protein rest" width="150" height="144" /> </a>[/caption] //Your caption code above with alignnone changed to aligncenter </div> <div style="float:left;"> [caption align="aligncenter" width="143" caption="Saccharification rest" captionalign="center"] <a href="http://www.mysite.com/wp-content/uploads/2008/06/saccharification-rest.jpg"> <img title="Mash during saccharification rest" src="http://www.mysite.com/wp-content/uploads/2008/06/saccharification-rest-143x150.jpg" alt="Mash during saccharification rest" width="143" height="150" /> </a>[/caption] </div> </div> // End the Block Div </div> // End the Center Div
[EDIT : Just saw you answered yourself -.- posting anyway :D]
相关问答
更多-
这里有一些工作让你开始。 html, body { box-sizing: border-box; } h1 { text-align: center; } .wrapper { text-align: center; } p { text-align: left; margin-top: 20px; border: 1px solid #000; padding: 10px; height: 150px; } .fitness-section { display ...
-
如何并排添加两个数字,并为每个数字插入标题?(How to add two figures side by side, and insert captions to each of them?)[2022-08-14]
您可以将这些数字放入无边界的两列表格中。 你的照片实际上放在一个不可见的桌子上。 然后,您可以为每个图片添加标题,Word将提供不同的图形编号。 You can put the figures into a borderless two-column table. Your pictures are actually put in an invisible table. Then you can add captions to each of the pictures and Word will provi ... -
使用HTML5 figure元素包装每个图像,然后在每个图像中添加一个figcaption元素以figcaption标题。 您可以将图形的display属性设置为inline-block以使它们彼此相邻,然后将它们设置为类似于当前使用.pic类设置图像样式的样式。 Use the HTML5 figure element to wrap each image and then add a figcaption element within each to conation your captions. Yo ...
-
给这个镜头: 在您各自网站的自定义样式中,将这些样式添加到表单的父包装中。 我已经用当前的代码和主题对此进行了测试,并且它似乎可行: .hb-form-table { display: flex; justify-content: space-between; } 这将做的是确保项目在一个灵活的容器中,不允许他们去下一行。 需要一些额外的CSS来确保输入字段都具有相同的填充和高度。 如果您刚接触flex-box,请参阅如何使用它的完整指南及其所有属性: https : //css-tric ...
-
如何在本地和远程端之间同步wordpress?(how can i synchronize wordpress between local side and remote side?)[2021-05-28]
有一个名为Database Sync的Wordpress插件,它允许您在Dev,QA和Production等多个服务器上同步WP数据库。 但它不允许您同步上传的文件。 http://wordpress.org/plugins/database-sync/ 您可以使用FTP同步软件来保持上传的文件同步。 我使用WinSCP。 There's a Wordpress plugin called Database Sync which lets you sync your WP database across m ... -
尝试使用DIV将其分为两部分。 float:left; 第一次DIV Try to separate that in two parts using DIV. Give float:left; to first DIV
-
我不能让照片并排(I cant make pictures go side by side)[2023-02-01]
我们试试看: .container_img { display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex; align-items: center; justify-content: center; } 和将两个带有字幕的图片并排堆叠在Wordpress中心(Stacking two pictures with captions side by side and centered in Wordpress)[2023-05-13]
我不确定你是否在寻找 使用标题和HTML代码通过Wordpress编辑器进行快速修复 通过Wordpress html编辑器快速修复手动重新创建字幕代码 通过functions.php文件和wp-includes / media.php中的add_shortcode()进行永久性修复 通过CSS永久修复可能会影响所有标题。 我尽量保持你的代码不受影响// This should align the entire block [it work ...将它们包裹在容器中。 并使用下面的CSS相关文章
更多- The Log: What every software engineer should know about real-time data's unifying abstraction
- solr 4.4 Error filterStart 问题
- Real-Time Rendering 笔记 --- 1-4章
- eclipse里报:An internal error occurred during:
- syntax error near unexpected token的解决办法
- The connection to adb is down, and a severe error has occured.
- solr error logs org.apache.solr.common.SolrException: ERROR: [doc=17] unknown field alias
- C程序访问Hadoop出现的各种编译错误和运行时各种类DefFound异常的解决方法
- Hadoop Real-World Solutions Cookbook
- Solr安装异常:SolrException: Error loading class 'solr.VelocityResponseWriter'
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。