Using IPhreeqc in Excel

djb14128

New Member
Joined
Nov 14, 2019
Messages
27
I can't get excel to do what I want after creating this VBA script:

Sub sbCopyRangeToAnotherSheet()


LastColumn = ActiveSheet.UsedRange.Columns(ActiveSheet.UsedRange.Columns.Count).Columns

For n = 63 To 63
For i = n To n
Worksheets("Data").Activate
Worksheets("Data").Range(Cells(i, 45), Cells(i + 6, 54)).Copy
Worksheets("Data").Activate
Worksheets("Data").Range(Cells(63, 64), Cells(69, 74)).PasteSpecial xlPasteAll
RunPhreeqc
Worksheets("Output").Activate
Worksheets("Output").Range(Cells(2, 20), Cells(8, 29)).Copy
Worksheets("Data").Activate
Worksheets("Data").Range(Cells(i + 10, 45), Cells(i + 16, 54)).PasteSpecial xlPasteAll


Next i
'Application.ScreenUpdating = True


Next n
For i = n + 20 To 103
Worksheets("Data").Activate
Worksheets("Data").Range(Cells(i, 45), Cells(i + 6, 54)).Copy
Worksheets("Data").Activate
Worksheets("Data").Range(Cells(63, 64), Cells(69, 74)).PasteSpecial xlPasteAll
RunPhreeqc
Worksheets("Output").Activate
Worksheets("Output").Range(Cells(2, 20), Cells(8, 29)).Copy
Worksheets("Data").Activate
Worksheets("Data").Range(Cells(i + 10, 45), Cells(i + 16, 54)).PasteSpecial xlPasteAll


Next i
End Sub


What I am trying to do here is copy data from 'Data' sheet and paste it to the same 'Data' sheet. Then I run IPhreeqc, and copy and paste the output from the 'Output' sheet back into the 'Data' sheet. The problem here is that VBA is not highlighting the range of cells I want, it just highlights the range of cells a row down. Many thanks in advance.
 
Last edited:

Some videos you may like

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

djb14128

New Member
Joined
Nov 14, 2019
Messages
27
I want VBA/excel to do this step over and over until I want it to stop. The number of cells between the the first table is the same as the next table down. The table have the same range as the next table down. There are multiple tables that I have to fill in after that, that's why I want excel/VBA to carry out the loop multiple times until I want it to stop.
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,099,392
Messages
5,468,332
Members
406,579
Latest member
lollypop1389

This Week's Hot Topics

Top