我已经花了好几个小时来解决这个问题,但是我找不到合适的解决方案.
这是我的问题描述:
我想循环遍历一个工作簿中的特定范围的单元格并将值复制到另一个工作簿.根据第一个工作簿中的当前列,我将值复制到第二个工作簿中的不同工作表.当我执行我的代码时,我总是得到runtime error 439: object does not support this method or property.
我的代码看起来或多或少像这样:
Sub trial()
Dim Group As Range
Dim Mat As Range
Dim CurCell_1 As Range
Dim CurCell_2 As Range
Application.ScreenUpdating = False
Set CurCell_1 = Range("B3") 'starting point in wb 1
For Each Group in Workbooks("My_WB_1").Worksheets("My_Sheet").Range("B4:P4")
Set CurCell_2 = Range("B4") 'starting point in wb 2
For Each Mat in Workbooks("My_WB_1").Worksheets("My_Sheet").Range("A5:A29")
Set CurCell_1 = Cells(Mat.Row, Group.Column) 'Set current cell in the loop …Run Code Online (Sandbox Code Playgroud) 我想使用“lattice”包的 levelplot 函数将概率分布函数 (PDF) 绘制为 R 中的热图。我将 PDF 实现为一个函数,然后使用两个向量作为值范围和外部函数生成 levelplot 的矩阵。我希望轴显示我的问题是我无法在两个轴上添加适当间隔的刻度线,分别显示两个实际值范围而不是列数或行数。
# PDF to plot heatmap
P_RCAconst <- function(x,tt,D)
{
1/sqrt(2*pi*D*tt)*1/x*exp(-(log(x) - 0.5*D*tt)^2/(2*D*tt))
}
# value ranges & computation of matrix to plot
tt_log <- seq(-3,3,0.05)
tt <- exp(tt_log)
tt <- c(0,tt)
x <- seq(0,8,0.05)
z <- outer(x,tt,P_RCAconst, D=1.0)
z[,1] <- 0
z[which(x == 1),1] <- 1.5
z[1,] <- 0.1
# plot heatmap using levelplot
require("lattice")
colnames(z) <- round(tt, 2)
rownames(z) <- x
levelplot(z, cex.axis=1.5, cex.lab=1.5, col.regions=colorRampPalette(c("blue", "yellow","red", "black")), at=seq(0,1.9,length=200), …Run Code Online (Sandbox Code Playgroud)