我可以修改此宏使其仅在一列上运行吗?

时间:2018-09-19 01:54:27

标签: excel vba

我正在使用它来查找和替换值,并且在打开的整个工作表中都可以正常工作:

2018-09-19 01:17:18 28b0 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2018-09-19  1:17:18 10416 [Note] InnoDB: innodb_empty_free_list_algorithm has been changed to legacy because of small buffer pool size. In order to use backoff, increase buffer pool at least up to 20MB.
2018-09-19  1:17:18 10416 [Note] InnoDB: Using mutexes to ref count buffer pool pages
2018-09-19  1:17:18 10416 [Note] InnoDB: The InnoDB memory heap is disabled
2018-09-19  1:17:18 10416 [Note] InnoDB: _mm_lfence() and _mm_sfence() are used for memory barrier
2018-09-19  1:17:18 10416 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-09-19  1:17:18 10416 [Note] InnoDB: Using generic crc32 instructions
2018-09-19  1:17:18 10416 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2018-09-19  1:17:18 10416 [Note] InnoDB: Completed initialization of buffer pool
2018-09-19  1:17:18 10416 [Note] InnoDB: The first specified data file C:\xampp\mysql\data\ibdata1 did not exist: a new database to be created!
2018-09-19  1:17:18 10416 [Note] InnoDB: Setting file C:\xampp\mysql\data\ibdata1 size to 10 MB
2018-09-19  1:17:18 10416 [Note] InnoDB: Database physically writes the file full: wait...
2018-09-19  1:17:18 10416 [ERROR] InnoDB: Cannot create C:\xampp\mysql\data\ib_logfile101
2018-09-19  1:17:18 10416 [ERROR] Plugin 'InnoDB' init function returned error.
2018-09-19  1:17:18 10416 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-09-19  1:17:18 10416 [Note] Plugin 'FEEDBACK' is disabled.
2018-09-19  1:17:18 10416 [ERROR] Unknown/unsupported storage engine: InnoDB
2018-09-19  1:17:18 10416 [ERROR] Aborting

我想对其进行编辑,以便仅在U列上运行,而不是在整个工作表上运行。

我已经看到其他人尝试使用Sub replaceStringInCells() Dim wTxt As String Dim rTxt As String Dim rNum As Integer rNum = 0 For Each Row In Range("swapvalues").Rows '<== change the wordlist Name here as required wTxt = Row.Cells(1).Value rTxt = Row.Cells(2).Value Selection.Replace What:=wTxt, Replacement:=rTxt, LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False rNum = rNum + 1 Next End Sub 之类的行来解决此问题,但是我不确定在上面的代码中将其添加在哪里,或者这是否是最好的方法。

如果有人有建议,我将不胜感激。

1 个答案:

答案 0 :(得分:2)

 Range("U:U").Replace What:=wTxt, Replacement:=rTxt, LookAt:=xlPart